Django开发,由sqlite3切换为mysql
已经假装过了, 迁移时,报错:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.mysql
解决办法:sql
按图找到你Django目录下的base.py文件
注释掉下面2句:数据库
if version < (1, 3, 13):
raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.version)django
而后再进行数据库迁移操做。ide
若是还有问题,好比出现了如下问题:
File "D:\Program Files\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'ui
那就打开上图中的operations.py文件,146行中的decode改成encode便可。3d
而后再次迁移,成功!code