美文网首页工作生活
mysqlclient 1.3.13 or newer is r

mysqlclient 1.3.13 or newer is r

作者: 星星在线 | 来源:发表于2020-02-29 11:47 被阅读0次

1、修改文件site-package/django/db/backends/mysql/base.py

注释掉if判断

2、修改文件site-package/django/db/backends/mysql/operations.py

from django.utils.encoding import force_text

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, '_executed', None)
    if query is not None:
        if type(query) == bytes:
            query = query.decode(errors='replace')
        elif type(query) == str:
            query = query.encode(errors='replace')
        else:
            query = force_text(query, errors='replace')
    return query

相关文章

网友评论

    本文标题:mysqlclient 1.3.13 or newer is r

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