工作生活

mysqlclient 1.3.13 or newer is r

2020-02-29  本文已影响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
上一篇 下一篇

猜你喜欢

热点阅读