首页 > 移动平台 > 详细

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

时间:2018-12-12 10:04:39      阅读:983      评论:0      收藏:0      [点我收藏+]

一:报错 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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!