解决:Specifying a namespace in include() without providing an app_name和XXX is not a registered namespa

Posted 玉米炖排骨

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决:Specifying a namespace in include() without providing an app_name和XXX is not a registered namespa相关的知识,希望对你有一定的参考价值。

python3 Django 环境下,如果你遇到namespace没有注册以及在根目录下urls.py中的include方法的第二个参数namespace添加之后就出错的问题。

出错问题:

\'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.

解决方法:

请在[app_name]目录下的urls.py中的urlpatterns前面加上app_name=\'[app_name]\', [app_name]代表你的应用的名称。可以参考这篇:https://stackoverflow.com/questions/14892462/django-error-upolls-is-not-a-registered-namespace

 

  

 

以上是关于解决:Specifying a namespace in include() without providing an app_name和XXX is not a registered namespa的主要内容,如果未能解决你的问题,请参考以下文章

'Specifying a namespace in include() without providing an app_name '

Django学习之django3.0.3报错:Specifying a namespace in include() without providing an app_name

Django2.0异常:Specifying a namespace in include() without providing an app_name is not supported.

解决git未指定冲突处理方法的问题 - hint: Pulling without specifying how to reconcile divergent branches ishint: di(

4.8 Routing -- Specifying The URL Type

指定表单使用的路由 Specifying the Route Used by a Form