'news' is not a registered namespace
来源:4-4 项目开发环境介绍(服务器环境和Pycharm远程开发设置)
arwe
2019-08-22
DJANGO_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.humanize", # Handy template tags
#"django.contrib.admin",
]
THIRD_PARTY_APPS = [
"crispy_forms",
"allauth",
"allauth.account",
"allauth.socialaccount",
"rest_framework",
"django_celery_beat",
"sorl.thumbnail"
]
LOCAL_APPS = [
"zanhu.users.apps.UsersConfig",
# Your stuff: custom apps go here
] url配置path("", TemplateView.as_view(template_name="pages/home.html"), name="home"),
path(
"about/", TemplateView.as_view(template_name="pages/about.html"), name="about"
),
# User management
path("users/", include("zanhu.users.urls", namespace="users")),
path("accounts/", include("allauth.urls")),
2回答
-
Jack
2019-08-23
在项目文件夹中全局搜一下“news”,到4-4小节还没有开发这个模块,是哪里写多了
00 -
arwe
提问者
2019-08-22
urlpatterns = [
# 用户管理
path('accounts/', include('allauth.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG:
# DEBUG=True的时候可以调试出错页面
urlpatterns += [
path('400/', default_views.bad_request, kwargs={'exception': Exception('Bad Request!')}),
path('403/', default_views.permission_denied, kwargs={'exception': Exception('Permission Denied')}),
path('404/', default_views.page_not_found, kwargs={'exception': Exception('Page not Found')}),
path('500/', default_views.server_error),
]
if 'debug_toolbar' in settings.INSTALLED_APPS:
import debug_toolbar
urlpatterns += [path('__debug__/', include(debug_toolbar.urls))] 修改成这样还是不行00
相似问题