当我在MySQL上运行Django的migrate
命令时,收到警告:
$ ./manage.py migrate
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/2.1/ref/databases/#mysql-sql-mode
当我查看该URL时,他们建议在'init_command'
中添加DATABASE['OPTIONS']
(也称为here和here)。所以我做到了:
DATABASES['default']['OPTIONS'] = {
# Set MySQL strict mode.
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
}
但是警告并没有消失。
关于如何进一步调试的任何建议?