django-AttributeError: 'str' object has no attribute 'decode'

时间:2020-05-11 23:51:09   收藏:0   阅读:83

一、Django数据同步过程中遇到的问题:
以下2步骤都需要修改:
  

1、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:\Python37\Lib\site-packages\django\db\backends\mysql(python安装目录)打开base.py,注释掉以下内容:

        if version < (1, 3, 13):

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

  

2、File "C:\Python37\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

  解决办法:打开此文件把146行的decode修改为encode

 

原文:https://www.cnblogs.com/vmsysjack/p/12872819.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!