vendredi 9 janvier 2015

Issue with Django Web Tutorial


Vote count:

0




I am extremely new to programming, and am attempting to learn Python so that I can create small programs to help in my research. I am completely new to programming, apart from some basic code in Stata. I'm trying to learn Python because I've been told that it's one of the best languages for beginners like myself.


Fortunately, my brother is a very capable programmer, and helped set me up with Python and Django. Unfortunately, he's on the West Coast and I'm on the East Coast, and the time difference and respective work schedules make it difficult for him to help me. So I turn to you.


I searched and found a few similar threads here, though unfortunately the answers in those threads didn't seem to fix my own issue :(


Problem


I am working my way through the Django tutorials, and I am on the third tutorial: http://ift.tt/1pJ82rg


I'm not sure if this matters, but I am working on a Macintosh w/ Mavericks.


The root directory in which I am working is 'Test2'. The directory structure is:


/Users/me/src/collact/collact/test2/


Within 'test2', and per the previous two tutorials, I have '/polls' and '/templates' folders.


My polls/views.py file has the following text:



from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")


My polls/urls.py file has the following text:



from django.conf.urls import patterns, url

from polls import views

urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
)


Finally, in /test2/, I have a urls python file as well (.py). It has the text:



from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns('',
url(r'^polls/', include('polls.urls')),
url(r'^admin/', include(admin.site.urls)),
)


As far as I can tell, this is what the tutorial prescribes. Unfortunately, when I run the server using: python manage.py runserver, the website gives me an error/404 message:



Page not found (404)
Request Method:
GET Request
URL: xhttp://localhost:8000/polls/ Using the URLconf defined in
test2.urls, Django tried these URL patterns, in this order: ^admin/
The current URL, polls/, didn't match any of these. You're seeing this
error because you have DEBUG = True in your Django settings file.
Change that to False, and Django will display a standard 404 page.


Note: I put an 'x' in front of the http because StackOverflow thought it was a link.


Does anyone have any idea how I can fix this? I know that this is a really stupid question, but I have been trying to figure it out for the past day or two, and unfortunately I'm just not familiar enough with programming to solve this on my own.


Thanks!


Jacob



asked 5 secs ago







Issue with Django Web Tutorial

Aucun commentaire:

Enregistrer un commentaire