[Answered ]-Django views / URLS page now loading

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.

Leave a comment