[英]Django social_django 'Specifying a namespace in include() without providing an app_name '
When I am trying to run 当我试图跑步时
python manage.py makemigrations
The following error is shown, 显示以下错误,
path('account/', include('django.contrib.auth.urls', namespace='auth')),
File "/home/barsmansvps/DataScience/anaconda3/lib/python3.6/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.
Here is my project urls.py file, 这是我的项目urls.py文件,
from django.contrib import admin
from django.urls import path, include
# For google login
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('', include('home.urls')),
# path('', include('pages.urls')),
path('products/', include('products.urls')),
path('reports/', include('reports.urls')),
path('account/', include('social_django.urls', namespace='social')),
path('account/', include('django.contrib.auth.urls', namespace='auth')),
path('admin/', admin.site.urls),
]
Quoting from the Django Documentation these are the possible signatures of include()
method 引自Django文档,这些是include()
方法的可能签名。
include(module, namespace=None, app_name=None) include(pattern_list) include((pattern_list, app_namespace), namespace=None) include((pattern_list, app_namespace, instance_namespace))
So change your urls.py
as 因此,将您的urls.py
更改为
urlpatterns = [
path('', include('home.urls')),
# path('', include('pages.urls')),
path('products/', include('products.urls')),
path('reports/', include('reports.urls')),
path('account/', include(('social_django.urls', 'social_django'), namespace='social')), path('account/', include(('django.contrib.auth.urls', 'django'), namespace='auth')),
path('admin/', admin.site.urls),
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.