使用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‘))

  

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

上一篇:微信获取用户数据后台写法,author2.0认证


下一篇:uni-app系列----简介了解