在使用Django2.2开发的时候,想要使用mysql数据库,在settings.py文件中更改命令:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'python',
'USER': "root",
'PASSWORD': "yhr2323214310",
'HOST': '',
'PORT': ''

}
}

再安装好pymysql,然后在__init__.py文件中添加:

import pymysql

pymysql.install_as_MySQLdb()

然后在models中创建好表类后,进行数据迁移时出现问题:

django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None

上网查一下解决方法,费了好大劲

解决方法:

1.找到base.py文件,我的是在~/PycharmProject/myBlog/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py

就是在你项目文件夹下的/venv/lib/python3.6/site-packages/django/db/backends/mysql/中

进去进行修改:

找到这段代码:version = Database.version_info

修改下面的if语句:添加pass,再注释掉,就像这个样子:

if version < (1, 3, 13):
pass
'''
raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
'''

保存后,在进入同路径下的operations.py文件

将query = query.decode(errors='replace')中的decode改为encode

保存

再次进行数据迁移,成功!可以成功连接到mysql。

Django2.2连接mysql数据库出现django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None问题的更多相关文章

  1. django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11

    搭建Django2.0+Python3+MySQL5时同步数据库时报错:django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 o ...

  2. Django2.2报错 django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

    准备将 Django 连接到 MySQL,在命令行输入命令 python manage.py makemigrations 后报错: django.core.exceptions.Improperly ...

  3. django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.2的最佳处理方法,亲测可用

    django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.2 ...

  4. django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.解决办法

    "E:\API_Manager_PlatForm\venv\lib\site-packages\django\db\backends\mysql\base.py"在这个路径里件把b ...

  5. django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

    异常汇总:https://www.cnblogs.com/dotnetcrazy/p/9192089.html 这个是Django对MySQLdb版本的限制,我们使用的是PyMySQL,所以不用管它 ...

  6. Django生成脚本迁移文件时,报错django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

    一.本人环境:django:3.0.2, python:3.8.1,  pymysql:0.9.3 二.解决步骤: 1.django目录下找到 base.py文件: 2.在base.py文件中注释以下 ...

  7. django2.2/mysql ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3

      报错环境 python=3.6.5,django=2.2,PyMySQL=0.9.3 …… django.core.exceptions.ImproperlyConfigured: mysqlcl ...

  8. exceptions: django2.2/ mysql ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3

    在centos部署python应用后访问页面,显示如下异常信息 报错环境 python=3.6,django=2.2……django.core.exceptions.ImproperlyConfigu ...

  9. Django项目配置数据库时,已安装mysqlclient,却提示 Did you install mysqlclient错误,后右报错ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3

    错误信息如下: 解决方案是: 找到自己的项目文件夹下的__init__.py  添加如下代码 解决这个问题后,右报错django2.2/mysql ImproperlyConfigured: mysq ...

随机推荐

  1. 【luogu1797】faebdc的烦恼-莫队

    题目背景 鸟哥(faebdc)自从虐暴NOIP2013以来依然勤奋学习,每天上各种OJ刷题,各种比赛更是不在话下.但这天他遇到了一点小小的麻烦……在一届“Orz鸟哥杯”上,题目是在是太多了!足有n道! ...

  2. Git出现 fatal: Pathspec 'xxx' is in submodule 'xxx' 异常的解决方案

    今天在使用git的时候,发现无论怎么改.gitignore文件都无法添加文件到版本控制,最后发现是缓存的原因,需要删除缓存再重新add git rm -rf --cached xxx

  3. ansible-cmdb 解析(ansible all -m setup )收集过来的信息并以html方式显示。

    首先安装 ansible-cmdb 直接pip install ansible-cmdb 安装 然后执行收集信息命令 ansible all -m setup >/tmp/out/ 修改下ans ...

  4. jquery 页面input上传图后显示

    <input type="file" id="otherfiles" name="otherfiles" class="up ...

  5. 20182332 实验四《Java Socket编程 》实验报告

    20182332 实验肆<数据结构与面向对象程序设计>实验报告 课程:<程序设计与数据结构> 班级: 1823 姓名: 盛国榕 学号:20182332 实验教师:王志强 实验日 ...

  6. Linux 系统配置永久性时间同步

    临时修改系统时间(reboot后系统时间恢复): date 查看系统时间 date -s  "设置的系统时间" 永久性修改系统时间: date 查看系统时间 hwclock --s ...

  7. Mac下持续集成-与JMeter与Ant执行后自动发送邮件的整合+定时任务

    mac定时任务的开启: Last login: Tue Aug 13 22:49:54 on ttys004 (base) localhost:~ ligaijiang$ sudo launchctl ...

  8. rc.local 注意事項,call python script, file position

    如果要在 rc.local 呼叫 python script python script 的位置需使用絕對路徑 其 python script 裡的有關 file 的位置也需使用 絕對路徑 如果要在 ...

  9. vue-cli项目模板的一些思考

    之前有个想法,就是要利用vue写一套ui.然后当时也没有搞清楚到底怎么写. 几经周转吧,通过付费的方式在gitbook上面找到了答案. 找到答案之后再看我们正在开发的项目,看伙伴写的代码,突然发现完全 ...

  10. kotlin委托属性

    fun main(arg: Array<String>) { val myClass1 = myClass1() myClass1.name="mycalsss1" v ...