当前位置 : 主页 > 编程语言 > python >

django报错"doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS."

来源:互联网 收集:自由互联 发布时间:2022-06-18
背景: 项目tgapi下有两个app:home和user 使用xadmin后台管理 在home/adminx.py中导入user的model中的某张表的时候报错 doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. 从字面意思

背景:

项目tgapi下有两个app:home和user

使用xadmin后台管理

在home/adminx.py中导入user的model中的某张表的时候报错

doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

从字面意思看是没有在django的配置文件中安装app,

事实,已经在django中安装app,如下:

django报错"doesn

既然已经安装了,并且前面使用都没问题,就现在跨app导入表的时候,才出现报错,那么应该就是django没能正确识别出路径。

然后,就直接在配置文件中安装app的时候,使用全路径,不用简写

django报错"doesn

导入使用表的时候,路径也写全,问题就解决了。

这种跨app导表的场景不知道多不多,刚刚学习编程,兴趣想学python,就在捣鼓捣鼓


【文章转自荷兰服务器 http://www.558idc.com/helan.html 欢迎留下您的宝贵建议】
网友评论