遇到的错误:
AttributeError: ‘‘str’’ object has no attribute '‘decode’'
这基本是使用Django2.2的童鞋们经常遇到的问题!!!
下面给出 三种解决方法。
首先需要说明的是:
这三种解决方法时临时解决方法。
其次:
若以后童鞋们遇到更好的解决方法,可以在下方评论。
方法一:
这个最简单粗暴!
直接将出错的两句代码给注释掉。
出错代码位于
/home/soul/anaconda3/lib/python3.6/site-packages/django/db/backends/mysql/operations.py
第140行
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