快捷导航

django学习中遇到一个错误

RuntimeError: Model class users.models.UserProfile doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded.
之前有类似的回答,不过照着做依然有这个报错。请各位大神帮帮忙!
补充:发现这个错误在 from users.models import VerifyCode 时就会出现,users.models下有UserProfile、VerifyCode2个类。
users.models import VerifyCode会导致错误,但是from apps.users.models import VerifyCode就无错误,sys.path.insert(0, os.path.join(BASE_DIR, 'apps'))已添加,INSTALLED_APPS也已经设置,很奇怪。

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

参与会员1

你用是在apps目录建的app吗
回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP