背景: 项目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,如下:
既然已经安装了,并且前面使用都没问题,就现在跨app导入表的时候,才出现报错,那么应该就是django没能正确识别出路径。
然后,就直接在配置文件中安装app的时候,使用全路径,不用简写
导入使用表的时候,路径也写全,问题就解决了。
这种跨app导表的场景不知道多不多,刚刚学习编程,兴趣想学python,就在捣鼓捣鼓