前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Django错误:RuntimeError: Model class user.models.UserAccount doesn't declare an explicit app_label

Django错误:RuntimeError: Model class user.models.UserAccount doesn't declare an explicit app_label

作者头像
Python疯子
发布2018-09-06 16:13:32
6K0
发布2018-09-06 16:13:32
举报
文章被收录于专栏:Python疯子Python疯子

错误:

代码语言:javascript
复制
        RuntimeError: Model class user.models.UserAccount doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

解决方案:

代码语言:javascript
复制
        方案一、删除关于模型层from xxx import UserAccount的引用(不推荐此方法)

        方案二、

                          检查注册app的settings文件,是否是这样注册的:'apps.user'(apps为装app文件夹)

                          检查你引用UserAccount的地方,是否这样引用:from apps.user.models import UserAccount

                          检查urls.py的引用是否是这样引用:apps.user.urls

若还有错误继续检查有引用模型文件夹下.py文件的地方,

把 user 的引用改为 apps.user 的引用 将 from xxx.apps.users.models import User 改为 from users.models import User

原因网址:

https://stackoverflow.com/questions/35388637/runtimeerror-model-class-django-contrib-sites-models-site-doesnt-declare-an-ex

原因:

Django's Sites Framework is a contributed module bundled with the core library that allows for the use of a single Django application/codebase with different sites (that can use different databases, logic in views, etc). The SITE_ID setting, as stated in the docs, "is used so that application data can hook into specific sites and a single database can manage content for multiple sites."

In this particular case AllAuth requires the Sites Framework in order to function properly. Many other third-party libraries are built to safely handle cases where multiple sites may be present and as such may be best .

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018.06.23 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档