I have the following url patters in the project root's urls.py
:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('main/', include('main.urls', namespace='main')),
]
But django complains with the following message:
django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.
According Django's documentation, the pattern of 'main' should be correct. What's the problem?
You need to add app_name = 'main'
to the main.urls file. See example and description here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With