问题

django项目中,执行python manage migrate
这里写图片描述

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/1.10/ref/databases/#mysql-sql-mode

解决

在settings中,在DATABASES变量定义处下面添加

DATABASES['OPTIONS']['init_command'] = "SET sql_mode='STRICT_TRANS_TABLES'"

或者在DATABASES变量定义时,添加上面命令中所示的键值对。
这里写图片描述

Logo

更多推荐