Sunday, October 4, 2015

Re: NoReverseMatch at /polls/1/

> This is my mysite/url,py
>
> from django.contrib import admin
>
> urlpatterns = [
>     url(r'^admin/', include(admin.site.urls)),
>     url(r'^polls/', include('polls.urls',namespace = "polls")),
> ].
>

Oh, yep, there's the problem. You added a namespace called 'polls' but you aren't referencing it in your template, so the URL resolver isn't using your polls/urls.py file for that {% url %} call. You probably forgot to update the {% url %} tag after the tutorial portion that added the namespace to the mysite/urls.py file.

You need to update your {% url %} tag to use 'polls:detail' rather than just 'detail'. 

See the last code box on that tutorial page: https://docs.djangoproject.com/en/1.8/intro/tutorial03/#namespacing-url-names

-James

--
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+unsubscribe@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/CA%2Be%2BciUsnTc4ExDWWGycB5jt%3DBfNpnWxaYNi7tbVWggr%3DDC4qQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment