django.db.migrations.exceptions.MigrationSchemaMissing和raise ImproperlyConfigured('mysqlclient 1

Posted 小白coder

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了django.db.migrations.exceptions.MigrationSchemaMissing和raise ImproperlyConfigured('mysqlclient 1相关的知识,希望对你有一定的参考价值。

1.使用Python3.7 + Django2.2 + mysql 5.5 在执行(python manage.py migrate)命令时出现错误django.db.migrations.exceptions.MigrationSchemaMissing

原因是

 

 所以,需要重新安装高版本的sql,安装好之后,问题就解决了

 

 

2.Django数据同步过程中遇到的问题:

1)raise ImproperlyConfigured(\'mysqlclient 1.3.13 or newer is required; you have %s.\' % Database.__version__)

   django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

  解决办法:C:\\Python37\\Lib\\site-packages\\django\\db\\backends\\mysql(python安装目录)打开base.py,注释掉以下内容:

        if version < (1, 3, 13):

          raise ImproperlyConfigured(\'mysqlclient 1.3.13 or newer is required; you have %s.\' % Database.__version__)

  

2) File "C:\\Python37\\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\'

  解决办法:打开此文件把146行的decode修改为encode

 

参考

https://blog.csdn.net/qq_36963372/article/details/82558085

https://www.cnblogs.com/olivertian/p/10919550.html

 

以上是关于django.db.migrations.exceptions.MigrationSchemaMissing和raise ImproperlyConfigured('mysqlclient 1的主要内容,如果未能解决你的问题,请参考以下文章