Django Error u”‘polls” is not a registered namespace

The answer is to add namespaces to your root URLconf. In the mysite/urls.py file (the project’s urls.py, not the application’s), go ahead and change it to include namespacing:

urlpatterns = patterns('',
url(r'^polls/', include('polls.urls', namespace="polls")),
url(r'^admin/', include(admin.site.urls)),
)

Furthermore, in part 3 of the tutorial Namespacing URL names the use of app_name is mentioned as the accepted way for adding the polls namespace. You can add the line for this in your polls/urls.py as follows:

app_name="polls"
urlpatterns = [
    ...
]

Leave a Comment