【填坑】python3 使用django连接数据库报ImproperlyConfigured

这是一个没有模板的简书,我才不想自我介绍

直入主题

使用Django连接mysql,报错:ImproperlyConfigured

  File "C:\Python35\lib\site-packages\django-2.0-py3.5.egg\django\db\utils.py", line 202, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "C:\Python35\lib\site-packages\django-2.0-py3.5.egg\django\db\utils.py", line 110, in load_backend
    return import_module('%s.base' % backend_name)
  File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Python35\lib\site-packages\django-2.0-py3.5.egg\django\db\backends\mysql\base.py", line 36, in <module>
    raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None

解决方法
(1)找到: File "C:\Python35\lib\site-packages\django-2.0-py3.5.egg\django\db\backends\mysql\base.py",并打开该文件
(2)找到第36行(根据提示信息得知),注释下面的两行代码

if version < (1, 3, 3):
    raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)

推荐阅读更多精彩内容