Error solution: mysqlclient 1.3.13 or newer is required; you have 0.9.3

Create a database migration file or create a table error: django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

Django2.2.10 can no longer connect to the MySQL database according to the old method before and will report an error.

There are many solutions on the Internet, some of which I tried without success, I recommend this
solution without modifying the source code. Solution :

Step 1: Use

pip freeze > requirements.txt

Generate requirements.txt in the project directory

Step 2: Install the specified mysqlcilent version inside
Insert picture description here

pip install mysqlclient==1.4.6
Step 3: Delete the so-called "disguised" two lines of code in the previous version.

Insert picture description here

As shown above, comment out.

Then no error will be reported, and it is not recommended to modify the source code.

python manage.py migrate

Insert picture description here

Thanks for the contribution of this blogger [https://blog.csdn.net/KissTooTrue/article/details/104433377]

Guess you like

Origin blog.csdn.net/qq_45701131/article/details/105907483