django版本3.0.2

django3命名空间出错

path('user/', include('user.urls', namespace='user')),

 

错误一

a namespace in include() without providing an app_name '

在user中添加

app_name = 'apps.user'

 

继续报错:

"INSTALLED_APPS." % (module, name)
RuntimeError: Model class apps.user.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

原来引用方式

from apps.user import views

改为直接引用错误解决

from .import views

你可能感兴趣的:(python,django3)