zoukankan      html  css  js  c++  java
  • python django model创建表报错

    λ 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
    Flask目录
    Django目录
    前端目录
    python目录
    MySQL目录
    Oracle与Sql server的区别
    Git
    restful规范
    Django 解决跨域问题(写入到中间件中)
  • 原文地址:https://www.cnblogs.com/chengfengchi/p/13398543.html
Copyright © 2011-2022 走看看