Django projects being given mysql data migration interact with: AttributeError: 'str' object has no attribute 'decode'

Problem Description

Django project started, when we execute the command  python manage.py makemigrations the following error:

  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/operations.py", line 147, in last_executed_query
    query = query.decode(errors='replace')
AttributeError: 'str' object has no attribute 'decode'

 Solution

Down the error message, find the location of the error, the

query = query.decode(errors='replace') 修改成 query = query.encode(errors='replace')

 

 

 

 

Guess you like

Origin www.cnblogs.com/miaoning/p/11517033.html