Reputation: 3484
I got this error, but can't seem to figure it out. I copied it directly from a previous Django project, hence part of the confusion.
TemplateSyntaxError at Caught NoReverseMatch while rendering: Reverse for 'about' with arguments '()' and keyword arguments '{}' not found.
In my index.html, I have a link to {% url about %}
didn't link to the about.html template
Urls.py has this:
urlpatterns = patterns('django.views.generic.simple',
url(r'^about/$', 'direct_to_template', {"template":"about.html"}, name="about"),
)
Upvotes: 3
Views: 4040
Reputation: 3484
The problem was my second urlpattern was overriding the first pattern.
Instead of:
urlpatterns = patterns('',
it needed to be:
urlpatterns += patterns('',
Upvotes: 4
Reputation: 36513
Your url is ok. You need to check two things:
Upvotes: 0
Reputation: 10697
The url regex is expecting an ending slash. Does the offending url end with a slash?
If you do have a PREPEND_SLASHES settings differing from your last projects, that might explain the error you're seeing!
Upvotes: 0