python 启动web项目字符编码问题

毕设web项目启动时,报错

  File "D:\Program Files (x86)\Python\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'

找到错误代码(line146):query = query.encode(errors=‘replace’)

解决方法:把decode改为encode即可。

你可能感兴趣的:(Python)