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