1, add the following code to the __init__ project file folder of the same name
import pymysql pymysql.install_as_MySQLdb(),
2, modify the setting file
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'test2', 'USER':'root', 'PASSWORD':'Gauss_234', 'HOST':'139.155.131.188', 'POST':'3306', } }
3, mysql authorization
grant all privileges on test2.* to 'root'@'139.155.131.188' identified "password" with grant option;
flush privileges;
4, if this time would be an error to start django
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
修改\Python35\Lib\site-packages\django\db\backends\mysql\base.py
Open the following code after comments:
Django server restart after a good comment:
You receive the following error message,
AttributeError: 'str' object has no attribute 'decode'
python django file is found under the File> db file> backends> mysql> operations.py
The decode modified to encode
Finally, you can restart the service
Reference Links: http://www.pianshen.com/article/2285376009/