Django Caught NoReverseMatch - TemplateSyntaxError

I got this error, but I can not understand it. I copied it directly from a previous Django project, hence part of the confusion.

TemplateSyntaxError in Caught NoReverseMatch on rendering: Reverse for 'about' with arguments '()' and keyword arguments '{}' not found.

In my index.html, I have a link to a {% url about %}non-reference template about.html

Urls.py has this:

urlpatterns = patterns('django.views.generic.simple',
    url(r'^about/$', 'direct_to_template', {"template":"about.html"}, name="about"),
)
+3
source share
3 answers

The problem was that my second url overlapped the first pattern.

Instead:

urlpatterns = patterns('',

it should be:

urlpatterns += patterns('',
+4
source

URL- . URL- ?

PREPEND_SLASHES, , , !

0

Your url is ok. You need to check two things:

  • Is urls.py included from main urls.py?
  • Is the application attached to INSTALLED_APPLICATIONS in settings.py?
0
source

Source: https://habr.com/ru/post/1773905/


All Articles