I am currently trying out Django. I use the namespace argument in one of my include()s in urls.py. When I run the server and try to browse,
I get t
I am also face the same error in Django 2.2 and i solve it this way
urls.py file
urlpatterns = [
path('publisher-polls/', include('polls.urls', namespace='publisher-polls')),
]
polls/urls.py file
app_name = 'polls'
urlpatterns = [
path('', views.IndexView.as_view(), name='index')
]
example use of namespace in calss based view method
def get_absolute_url(self):
from django.urls import reverse
return reverse('polls.index', args=[str(self.id)])
example use of namespace in templates
{% url 'polls:index' %}
Here polls:index mean app_name[define in polls/urls.py file]:name[define in polls/urls.py file inside path function]
their official which is pretty good you can check for more info namespace_django_official_doc