执行 python3 manage.py startapp
mysql数据库时报错:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
解决办法:
pip3 show django
去django安装路径下
django\db\backends\mysql\base.py文件
将文件中的如下代码注释
if version < (1, 3, 3):
raise ImproperlyConfigured(“mysqlclient 1.3.3 or newer is required; you have %s” % Database.version)
即解决
执行迁移的时候
python3 manage.py makemigrations
File "/home/tom/.local/lib/python3.5/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'
进入/home/tom/.local/lib/python3.5/site-packages/django/db/backends/mysql/operations.py提示的文件 query = query.decode(errors='replace')改为encode即可
本文详细介绍了在使用Django框架与MySQL数据库进行迁移时遇到的错误:'mysqlclient1.3.13或更新版本所需;你有0.9.3.'以及AttributeError:'str'对象没有属性'decode'.提供了具体的解决方案,包括修改Django安装路径下的base.py文件和operations.py文件的代码。
903

被折叠的 条评论
为什么被折叠?



