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   # 创建表结构
  • 相关阅读:
    11、旋转图像
    10、有效的数独
    9、两数之和
    8、移动零
    6、两个数组的交集 II
    7、加一
    5、只出现一次的数字
    3、旋转数组
    spring快速复习
    mybatis XML SQL基本配置
  • 原文地址:https://www.cnblogs.com/chengfengchi/p/13398543.html
Copyright © 2011-2022 走看看