django2.2 配置mysql问题
报错信息:
File "C:\Users\liuxd\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\base.py", line 36, in <module
raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
进入 C:\Users\liuxd\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\base.py文件 注释掉报错的35、36行
再次运行 python manage.py makemigrations
报错:
File "C:\Users\liuxd\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\operations.py", line 146, in
last_executed_query
query = query.decode(errors='replace')
AttributeError: 'str' object has no attribute 'decode'
进入C:\Users\liuxd\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\operations.py 修改146行修改为:
query = query.encode(errors='replace')