问题一与解决方案
出现问题如下:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None
解决方案:
找到Python3安装路劲下的Python36\Lib\site-packages\django\db\backends\mysql\base.py文件
将文件中的如下代码注释:
# if version < (1, 3, 13):
# raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
问题二与解决方案
出现问题如下:
AttributeError: ‘str’ object has no attribute 'decode’
解决方案:
找到lib\site-packages\django\db\backends\mysql\operations.py文件
将文件的decode改成encode
def last_executed_query(self, cursor, sql, params):
# With MySQLdb, cursor objects have an (undocumented) "_executed"
# attribute where the exact query sent to the database is saved.
# See MySQLdb/cursors.py in the source distribution.
query = getattr(cursor, '_executed', None)
if query is not None:
query = query.encode(errors='replace') #query = query.decode(errors='replace')
return query