今天执行数据库脚本生成python manage.py makemigrations,出现以下错误:django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'。python
查询相关资料获得以下结果:大于Python3.X 版本,使用PyMySQL 链接数据库。mysql
安装完PyMYSQL后,在项目的__init__.py文件添加以下内容:sql
import pymysql pymysql.install_as_MySQLdb()