How to use namespace urls with django in a reusuable app

后端 未结 3 1073
孤街浪徒
孤街浪徒 2020-12-14 08:16

I have a django app, a forum app, that has templates with it. In those templates, there are urls that point to parts of the app. For instance the thread_list template has li

3条回答
  •  被撕碎了的回忆
    2020-12-14 08:21

    This might be a simple syntax error. I was following the Django Tutorial, and I changed mysite/urls.py improperly. The original syntax:

    url(r'^polls/', include('polls.urls')),
    

    The desired change:

    url(r'^polls/', include('polls.urls', namespace="polls")),
    

    What I did:

    url(r'^polls/', include('polls.urls'), namespace="polls"),
    

    Correcting the syntax resolved the issue.

提交回复
热议问题