1. Execute python manage.py makemigrations
报错内容:
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.
Mainly because MySQLclient currently only supports Python3.4, I used a higher version of python3.7.4
Solution:
Add a sentence under the __init__.py file with the same name as the project:
pymysql.version_info = (1, 4, 13, “final”, 0) # Specify version
2. Execute python manage.py makemigrations and report an error
内容如下:
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.
Solution:
Add a sentence under the configuration of the settings.py file database with the same name as the project:
‘OPTIONS’: {‘isolation_level’: None}
Re-execute the result
In this way, the database migration can be completed!
3. After adding that sentence, the database migration error is as follows
django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table ((1064, “You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near ‘(6) NOT NULL)’ at line 1”))
It means that mysql5.5 is not supported above django2.1 version.
I lowered the version of django and changed it to 1.11.28, just fine.