- 安装pymysql:
other setting---project Interpreter---+pymysql
- 更改数据库
在项目名的同名文件下的settings.py中DATABASES,改成
- 在项目的同名文件下的—init.py文件下添加语句
import pymysql
pymysql.install_as_MySQLdb()
- cmd创建数据库
- 迁移
生成迁移文件
python manage.py makemigrations
执行迁移文件
python manage.py migrate