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

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

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的相关文章

django启动服务时报错:RuntimeError: Model class index.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

在django框架中用命令启动服务时报如下错误: RuntimeError: Model class index.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. 解决方法: 我是这样解决的: 检查setting.py里面的INSTALLED_APPS,发现应用没有注册.把应用注册之后,重启服务就好了 其它解决方法,以后遇到了再补充. django启动服

django配置mysql报错 no model named "MySQLdb"

官网上面连接mysql数据库的参数很少,入了不少坑,一直排错和检查参数都没有问题,只能manage.py mirgrate 更新数据库的信息创建数据库的表. 很是郁闷.报了一大堆的错误,大概意思就是说没有MySQLdb这个模块 . no model named "MySQLdb" 举手无措的我,吓尿了.翻了百度,查找方法,安装mysqldb,mysql-python试了很多个都不行. 最后想了想报错的最后一行.是否安装mysqlclient. 抱着试一试的心态,离线安装了一个mysql

记一次django的诡异报错 Could not parse the remainder: '=' from '='

如题,一个展示日志的功能,调用该模板文件时报错,Could not parse the remainder: '=' from '='.这行模板语言在上面出现过同样的,仅仅是改了'<='右端的整数大小,而且该有的标签也不少. 百般思考无解,stackoverflow和百度都没答案.后来重新看了下开发文档,发现是Django的版本不对,开发时用的1.8.2,我部署时用的1.11.5.重新安装低版本的django后问题解决.但原因仍待查. 记一次django的诡异报错 Could not parse

Django urls.py报错: raise TypeError(&#39;view must be a callable or a list/tuple in the case of include()

Django urls.py报错: raise TypeError('view must be a callable or a list/tuple in the case of include() 报错信息 "F:\PyCharm 2016.2.2\bin\runnerw.exe" C:\Users\Administrator\AppData\Local\Programs\Python\Python35\python.exe F:/Django/blogs/manage.py run

Django——模版Template报错

>>> from django.template import Template >>> t = Template("My name is {{ my_name }}.") Traceback (most recent call last): File "C:\Python33\lib\site-packages\django\conf\__init__.py", line 38, in _setup settings_modul

django admin 中文报错incorrect string value解决方案

对于错误" Incorrect string value: '\xE6\xA2\xB5\xE8\x92\x82...'for column 'object_repr' at row 1 解决方法是设置django_admin_log表的object_repr一项使用utf8_unicode_ci: 对于错误"  Incorrect string value: '\xE6\xA2\xB5\xE8\x92\x82...'for column 'change_message' at row

Django 中文注释报错问题

views.py 前面一定要加# -*- coding: utf-8 -*-否则报错 # -*- coding: utf-8 -*- from django.shortcuts import render_to_response def index(req):     return render_to_response('index.html',{}) # 第一种方式 # 回送模板(第一个return),回送标题(req下直接return字符串) # from django.http impor

Django报错 No module named &#39;django.templates&#39;

前言 Django 模板报错了 修改方法: 将你的工程文件下(my_site)的settings.py中的TEMPLATES中的templates字段全部改为template, 亲测可用~^~ Django报错 No module named 'django.templates' 原文地址:https://www.cnblogs.com/yf-html/p/9314280.html

Django:django-cors-headers 报错no module named &quot;corsheaders&quot;

django跨域使用 pip install django-cors-headers 然后在settings文件中加上参数设置 # app配置 INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles