Django2.2连接mysql数据库出现django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None问题
在使用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问题的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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,所以不用管它 ...
- 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文件中注释以下 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- java线程安全与不安全的理解
存在成员变量(全局变量)的类用于多线程时是不安全的,不安全体现在这个成员变量可能发生非原子性的操作,而变量定义在方法内也就是局部变量是线程安全的. 想想在使用struts1时,不推荐创建成员变量,因为 ...
- C++泛型编程-扩展
类型做参数是C++模板实现的主要形式.由此实现了类模板-->模板类-->实例的过程 当然除此之外也可以参考bitset的实现方式,参数决定类型的做法. #include <iostr ...
- GitHub 更新fork的代码
转载地址:http://blog.csdn.net/do_it__/article/details/7836513 一.前提 本文的前提是你已经在github上fork了别人的分支,并且弄好了跟git ...
- linux中fork--子进程是从哪里开始运行
转自 http://blog.csdn.net/koches/article/details/7787468 fork调用的一个奇妙之处就是它仅仅被调用一次,却能够返回两次,它可能有三种不同的返回值 ...
- 关于lda算法的一个博客
http://www.cnblogs.com/LeftNotEasy/archive/2011/01/08/lda-and-pca-machine-learning.html
- gopub自动化发布平台安装
1.软件配置 centos7 mysql5.7.26 gopub1.1.3 2.硬件配置 4核8G aws rds aws 3.数据库配置 #这个不执行,执行下面一句 --CREATE DATABAS ...
- python的协程,monkeyPatch
monkey patch 一般指运行时候进行动态替换. 基本上我们使用gevent,会在最开头的地方加入gevent.monkey.patch_all();把标准库中的thread/socket等给替 ...
- hive安装常见错误
hive编译出错 mvn clean package -DskipTests -Phadoop-2 -Pdist 失败日志1 Failed to execute goal on project hiv ...
- linux java -jar
常见命令1 nohup java -jar /xxx/xxx/xxx.jar >/dev/>& & 分析各个指令代表什么意思: >,重写文件,如果文件里面有内容会覆盖 ...
- kotlin之函数的基本用法
fun main(arg: Array<String>) { val )//调用函数 print(double) } fun double(x:Int):Int{ *x } kotlin函 ...