Django url namespaces giving errors

Multi tool use
Multi tool use


Django url namespaces giving errors



I am new to the django framework. I currently started learning from an online video tutorial and I came across some errors. I have an app called groups which has two separate view files namely company and family. Due to that I have my groups/url file as this:


from django.urls import path, include, re_path


from . views import company
from . views import family

app_name = 'groups'

company_patterns = [
path('create/', company.Create.as_view(), name='create'),
re_path(r'^edit/(?P<slug>w+)/$', company.Update.as_view(), name='update'),
path('<str:slug>/', company.Details.as_view(), name='detail'),
]

family_patterns = [
path('create/', family.Create.as_view(), name='create'),
path('edit/<str:slug>/', family.Update.as_view(), name='update'),
path('<str:slug>/', family.Details.as_view(), name='detail'),
]

urlpatterns = [
path('companies/', include(company_patterns, namespace='companies')),
path('families/', include(family_patterns, namespace='families')),
]



But anytime I run the application from my dashboard template. I get this error:



'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.



Please, can anyone assist me with further explanation and solution? thank you




1 Answer
1



define app_name in another urls.py file






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

73l xdU4b4Yv1bY4cy8NkbPOoz2Bog Vp
qyVhgqOddY56cDG36c3i 2NKi7sgINFwa d 62wmCrggZZRkGdbeMHdHSminuMIKdj1P LW,rA,EYuTPuezyUshFr0EPl74KfXowBL

Popular posts from this blog

Rothschild family

Cinema of Italy