首页 > 编程语言 > 详细

python django model创建表报错

时间:2020-07-29 19:57:06      阅读:89      评论:0      收藏:0      [点我收藏+]

λ python manage.py migrate TestModel
System check identified some issues:

WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection ‘default‘
HINT: MySQL‘s Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/3.0/ref/databases/#mysql-sql-mode
Operations to perform:
Apply all migrations: (none)
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won‘t be applied.
Run ‘manage.py makemigrations‘ to make new migrations, and then re-run ‘manage.py migrate‘ to apply them.

 

 

执行 

python manage.py migrate

报错误

  Your models have changes that are not yet reflected in a migration, and so won‘t be applied.   Run ‘manage.py makemigrations‘ to make new migrations, and then re-run ‘manage.py migrate‘ to apply them.

这个错误是因为你的数据库文件更改需要更新一下

 

先执行下

python manage.py makemigrations 

在执行

python manage.py migrate 

就可以成功执行了

 

 

$ python manage.py migrate TestModel   # 创建表结构

python django model创建表报错

原文:https://www.cnblogs.com/chengfengchi/p/13398543.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!