I ran into the following problem with the tutorial. When I'm at http://127.0.0.1:8000/polls/1/, I get the expected page:
What's up? Not much The sky However when I try to vote I get the error Page not found (404)Request Method:POSTRequest URL: http://127.0.0.1:8000/polls/1/vote/ No Question matches the given query. 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. After some time I found that something is wrong with the urls. My polls/urls.py file was: ----------------- from django.conf.urls import patterns, url from polls import views urlpatterns = patterns('', # ex: /polls/ url(r'^$', views.index, name='index'), # ex: /polls/5/ url(r'^(?P<question_id>\d+)/$', views.detail, name='detail'), url(r'^(?P<begins_with>\S+)/$', views.search, name='search'), # ex: /polls/5/results/ url(r'^(?P<question_id>\d+)/results/$', views.results, name='results'), # ex: /polls/5/vote/ url(r'^(?P<question_id>\d+)/vote/$', views.vote, name='vote'), ) ------------------ If I remove the "/" after "vote", then everything works. I had the same error when attempting to view the results, so I also removed the "/" after results. My urls.py now looks like ... # ex: /polls/5/results url(r'^(?P<question_id>\d+)/results$', views.results, name='results'), # ex: /polls/5/vote url(r'^(?P<question_id>\d+)/vote$', views.vote, name='vote'), ... Can someone explain me what is going on? thanks. Note that the file mysite/urls.py is: ---------- from django.conf.urls import patterns, url from polls import views urlpatterns = patterns('', # ex: /polls/ url(r'^$', views.index, name='index'), # ex: /polls/5/ url(r'^(?P<question_id>\d+)/$', views.detail, name='detail'), url(r'^(?P<begins_with>\S+)/$', views.search, name='search'), # ex: /polls/5/results url(r'^(?P<question_id>\d+)/results$', views.results, name='results'), # ex: /polls/5/vote url(r'^(?P<question_id>\d+)/vote$', views.vote, name='vote'), ) -------- -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9f7a2a12-0e14-48a6-a70a-358deb5f7899%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.