Django2.2x, Python3.6在migrate時(shí)出現(xiàn)以下問題:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
網(wǎng)上流行注釋掉兩行,還是不行,另外總覺得去改設(shè)置文件也不是個好的習(xí)慣,繼續(xù)找路,發(fā)現(xiàn):
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:
- 刪除項(xiàng)目
__init__.py里pymysql的設(shè)置 pip install mysqlclient- 搞定!
進(jìn)一步可以參考這里:https://stackoverflow.com/questions/55472739/have-a-problem-using-django-2-2-with-pymysql