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

Django2.2x, Python3.6在migrate时出现以下问题:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

网上流行注释掉两行,还是不行,另外总觉得去改设置文件也不是个好的习惯,继续找路,发现:

As per this pull request, The problem is not only the version number of mysqlclient. As per this ticket #30380, there may be many places in django where support for PyMySQL could be broken, and Django will not fix them(probably). Also, as per tickets #12500, #22391, Django does not support PyMySQL officially.

所以用mysqlclient取代pymysql:

  1. 删除项目__init__.py里pymysql的设置
  2. pip install mysqlclient
  3. 搞定!

进一步可以参考这里:https://stackoverflow.com/questions/55472739/have-a-problem-using-django-2-2-with-pymysql

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容