Django 生成迁移文件时报错,查看Django中数据库配置没有问题
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': "sunck",
'USER': 'root',
'PASSWORD': 'a12345678',
'HOST': 'localhost',
'PORT': '3306',
}
}
网上查找许久,解决办法时手动创建数据库在进行文件迁移
mysql> create database sunck character set utf8;
Query OK, 1 row affected, 1 warning (0.03 sec)
yangdongxingdeMacBook-Pro:mystudy yangdongxing$ python3 manage.py makemigrations
Migrations for 'myApp':
myApp/migrations/0001_initial.py
- Create model Grades
- Create model Students
暂且先记录下,有新方法再进行更新
网友评论