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
:
- 删除项目
__init__.py
里pymysql
的设置 pip install mysqlclient
- 搞定!
进一步可以参考这里:https://stackoverflow.com/questions/55472739/have-a-problem-using-django-2-2-with-pymysql