进入到django项目的配置文件目录(包含setting.py文件的目录) 编辑 __init__.py 文件 # 添加如下内容 import pymysql pymysql.install_as_MySQLdb()