关于Django与mysql的配置错误问题

错误:

django2.2/mysql ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3

找到:找到base.py文件,注释掉 base.py 中如下部分(35/36行)

#if version < (1, 3, 3):
     #raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)

此时仍会会报错,报错信息如下:

AttributeError: ‘str’ object has no attribute ‘decode’

#找到operations.py文件(46行,版本不同行数不同哈~自个儿find一下),将decode改为encode

if query is not None:
    query = query.decode(errors='replace')
return query
#改为
if query is not None:
    query = query.encode(errors='replace')
return query

问题解决,正常启动!

posted @ 2020-03-15 09:12  一颗蘑菇头  阅读(264)  评论(0编辑  收藏  举报