Reputation: 773
So I am trying to call my url by using the following in one of my html templates -
<a href="{% url 'socialx:index' %}">
My apps urls.py file looks like this -
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^socialx/', include('socialx.urls')),
url(r'^admin/', include(admin.site.urls)),
]
And the root urls.py file is like this -
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^socialx/', include('socialx.urls'), name='socialx'),
url(r'^admin/', include(admin.site.urls)),
]
When navigating to the app via browser I get the following error -
NoReverseMatch at /socialx/ 'socialx' is not a registered namespace
Upvotes: 0
Views: 97
Reputation: 6116
Have a look at the documentation
I think that when you include the url in urls.py
you need to add a namespace
url(r'^socialx/', include('socialx.urls', namespace="socialx")),
And make sure that the url for going to the index page has a name=index
.
See if that helps.
Upvotes: 1