解决报错:from err django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?

前言

使用python manage.py makemigrations时出现报错:
from err django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?

解决办法

安装pymysql

pip install pymysql

在__init__.py中加入如下代码

import pymysql

pymysql.install_as_MySQLdb()

参考文章

《django安装了pymysql还报MySQLdb module: No module named》

posted @ 2020-06-25 18:21  cnhkzyy  阅读(530)  评论(0编辑  收藏  举报