2015-03-06 18:39 GMT-06:00 Collin Anderson <[email protected]>:

> Hi,
>
> That seems strange. The error says that there's no question with id=1. Are
> you sure there's a question with id=1?
>
> The ending slash seems important to me. I don't know why it would work
> without it.
>
> Collin
>
>
> On Wednesday, March 4, 2015 at 2:15:32 PM UTC-5, Daniel Altschuler wrote:
>>
>> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/db705c9f-f8a1-46e6-add8-a637671a603e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/db705c9f-f8a1-46e6-add8-a637671a603e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"La utopĂ­a sirve para caminar" Fernando Birri

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CAG%2B5VyOWaZTFBsSR6uirUXu1ZX%3DLhx-jKnHuyLTGSBoYVx-AkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to