django--mysql设置

mysql基本配置

'default': {
        'ENGINE': 'django.db.backends.mysql',
        'HOST': '127.0.0.1',
        'PORT': 3306,
        'USER': 'root',
        'PASSWORD': '123',
        'NAME': 'day1211',
}

 

当出现错误时

MySQL Strict Mode is not set for database connection 'default'

 


错误排除:(mysql.W002) MySQL Strict Mode is not set for database connection 'default'
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'mxshop', 'HOST': '127.0.0.1', 'PORT': '3306', 'USER': 'mxshop', 'PASSWORD': 'BSfdsfdsmxF', 'OPTIONS': { "init_command": "SET default_storage_engine='INNODB'" } } } DATABASES['default']['OPTIONS']['init_command'] = "SET sql_mode='STRICT_TRANS_TABLES'"#排除错误 ---------------------
AUTH_USER_MODEL='app01.UserInfo'
 

 

posted @ 2018-11-26 20:06  zhaijihai  阅读(152)  评论(0编辑  收藏  举报