美文网首页
django2.2/mysql ImproperlyConfig

django2.2/mysql ImproperlyConfig

作者: 优秀是一种习惯0 | 来源:发表于2019-05-30 17:01 被阅读0次

    这篇文章适合vim用不好的,或者根据网上答案还是没有解决的同学。

    解决方法是在正确的位置注释掉对mysqlclient限制的代码

    方法一:直接在项目中找到代码并注释掉

    需要删除代码如下:

     if version < (1, 3, 13):

        raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)

    文件路径如下:

    路径

    注释后,尝试迁移:

    python3 manage.py makemigrations

    python3 manage.py migrate

    如果成功了,直接看下一个bug解决方法,失败的话可能是因为你安装了anaconda,需要在anaconda中注释,见方法二。

    方法二:删除路径如下:

    路径1 路径2(接路径1)

    找到base.py文件,删除上述代码。

    这个问题已经解决。


    还有bug:

    再尝试迁移,发现还是报错。

    报错信息如下:

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

    #同上路径2,找到operations.py文件打开,将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

    问题解决!

    相关文章

      网友评论

          本文标题:django2.2/mysql ImproperlyConfig

          本文链接:https://www.haomeiwen.com/subject/rhxquttx.html