Django路径问题

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

出现的现象:

1、RuntimeError: Model class meiduo28.apps.users.models.User
2、User doesn’t declare an explicit app_label and isn’t in an application in INSTALLED_APPS.

排查

1、检查程序语法等问题,均正常
2、研究报错原因,怀疑导包出现问题。

进一步排查

在这里插入图片描述

检查结果

在这里插入图片描述

总结

1、当出现多个导包路径时,需要非常小心,不能简单用pychar提示导包。
2、所有在apps子应用内的导包,采用相对路径导包。

猜你喜欢

转载自blog.csdn.net/lujhww_66/article/details/94654836