使用url的时候添加app_name,提示错误:Specifying a namespace in include() without providing an app_name ' django.core.exceptions.ImproperlyConfigured: Specifying a ...

在使用url的时候,有些地方是这样写的:

 url(r'^blog/', include('blog.urls', namespace='blog',app_name='blog'))

  但是会报错:

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

只需要换种写法即可:

 url(r'^blog/', include(('blog.urls', 'blog'), namespace='blog'))

  

posted @ 2020-09-01 07:57  明明一颗大白菜  阅读(355)  评论(0编辑  收藏  举报
<-- -->