?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
问题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,
·
问题
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变量定义时,添加上面命令中所示的键值对。
更多推荐
已为社区贡献3条内容
所有评论(0)