1. install
pip3 install pymsql
2. Look for any one __init__ File plus the following code
import pymysql
pymysql.install_as_MySQLdb()
3. settings.py Configuration replacement
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysql',
'USER': 'root',
'PASSWORD': 'foobared',
'HOST': '106.14.42.253',
'PORT': 'xxx',
}
}
4. If the following error is reported , Just modify the source code (django2.2x Replace above mysql Will report a mistake , normal )
AttributeError: 'str' object has no attribute 'decode'
5. terms of settlement
Then re execute the database synchronization instruction