解决报错: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()

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

参考文章

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

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

上一篇:解决sqlalcemy 中提示 mysql中sql_mode=only_full_group_by" 问题


下一篇:HTTP 常见状态码【5种最最最常见的状态码】