2đź‘Ť
âś…
Your url r'blog/'
doesn’t have a $ at the end, so I think django will always match this entry rather than the r'blog/(?P<slug>[-\w]+)/$'
entry. I’d try reversing the order and see if that helps:
url(r'blog/(?P<slug>[-\w]+)/$', 'blog.views.blog', name="blog"),
url(r'blog/', 'blog.views.blog_index', name="blog_index"),
I’ve had that problem before and spent many hours trying to figure it out.
👤Nathan
0đź‘Ť
Your first urlconf entry is catching all URLs starting with “blog”. Put a $ on the end to terminate the match.
👤Daniel Roseman
- [Answered ]-Django – How to move attribute to another model and delete it
- [Answered ]-How to initialize Django ModelForms on an entire queryset?
- [Answered ]-CSRF protection always failing when trying to upload file with ajax
- [Answered ]-Getting string from CharField
- [Answered ]-How does one incorporate a Django application into an existing twisted server?
Source:stackexchange.com