一:报错 RuntimeError: Model class django.contrib.sites.models.Site doesn‘t declare an explicit app_label and isn‘t in an application in INSTALLED_APPS
出现这种情况需将Django的Sites框架添加到您的应用程序中,并在您的设置中将SITE_ID设置为1即可。位置放在默认配置的后面,其他应用的前面。
INSTALLED_APPS = [ ‘django.contrib.admin‘, ‘django.contrib.auth‘, ‘django.contrib.contenttypes‘, ‘django.contrib.sessions‘, ‘django.contrib.messages‘, ‘django.contrib.staticfiles‘, ‘django.contrib.sites‘,#这边是allauth的依赖包,必须在app和登录模块前面 ‘xproject‘, #登录模块 ‘allauth‘, ‘allauth.account‘, ‘allauth.socialaccount‘, ‘allauth.socialaccount.providers.github‘, ] SITE_ID = 1
二:
报错(‘42S02‘, "[42S02] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]对象名 ‘django_site‘ 无效。 (208)
这种情况需要同步一下数据库
执行 python manage.py makemigrations
python manage.py migrate
Django 使用allauth报错 RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS
原文地址:https://www.cnblogs.com/dayouzi/p/10106697.html
时间: 2024-10-12 07:32:15