錯誤:
RuntimeError: Model class user.models.UserAccount doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
解決方案:
方案一供搀、刪除關于模型層from xxx import UserAccount的引用(不推薦此方法)
方案二、
檢查注冊app的settings文件轩触,是否是這樣注冊的:'apps.user'(apps為裝app文件夾)
檢查你引用UserAccount的地方,是否這樣引用:from apps.user.models import UserAccount
檢查urls.py的引用是否是這樣引用:apps.user.urls
若還有錯誤繼續(xù)檢查有引用模型文件夾下.py文件的地方党觅,
把 user 的引用改為 apps.user 的引用
將
from xxx.apps.users.models import User
改為
from users.models import User
原因網址:
原因:
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 .