Django模板导入mysql时 -----(ImproperlyConfigured)异常

原创
10/18 16:26
阅读数 21

修改Django数据库为mysql时报错:

异常:

File "D:\pythonWorkEnvs\meiduo_mall\lib\site-packages\django\db\backends\mysql\base.py", line 36, in <module>
    raise ImproperlyConfigured('mysqlclient 1.4.0 or newer is required; you have %s.' % Database.__version__)
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.4.0 or newer is required; you have 0.10.1.

点击进入提示出错文件base.py,解决方式如图 :

version = Database.version_info
#注释掉以下两行代码
# if version < (1, 4, 0):
#     raise ImproperlyConfigured('mysqlclient 1.4.0 or newer is required; you have %s.' % Database.__version__)

如果修改后继续报以下异常:

raise RuntimeError("'cryptography' package is required for sha256_password or caching_sha2_password auth methods")
RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods

可以命令行:pip install -i https://pypi.douban.com/simple cryptography   

安装cryptography后。问题解决

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部