请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

'news' is not a registered namespace

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")),

正在回答 回答被采纳积分+3

2回答

Jack 2019-08-23 10:09:31

在项目文件夹中全局搜一下“news”,到4-4小节还没有开发这个模块,是哪里写多了

0 回复 有任何疑惑可以回复我~
提问者 arwe 2019-08-22 19:14:03

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))]   修改成这样还是不行

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号