I'm having trouble with the include function, according to the django documentation, the syntax is include(module, namespace=None)
include(pattern_list)
, include((pattern_list, app_namespace), namespace=None)
.
Source code
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('clientes/', include("cliente.urls", namespace="cliente")),
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Error
path('clientes/', include("cliente.urls", namespace="cliente")),
File "/home/phomint/DjangoProjects/Manager/myvenv/lib/python3.5/site-packages/django/urls/conf.py", line 39, in include
'Specifying a namespace in include() without providing an app_name '
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.