django连接数据库配置设置如下

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'test2',
        'USER':'root',
        'PASSWORD':'',
        'HOST':'192.168.100.198',
        'PORT': '3306',         # 数据库使用的端口
        'OPTIONS':{'init_command':'SET sql_mode="STRICT_TRANS_TABLES",storage_engine=INNODB;'}  #设置数据库为INNODB,为第三方数据库登录用
    }
}

修改为如下即可:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'test2',
        'USER':'root',
        'PASSWORD':'',
        'HOST':'192.168.100.198',
        'PORT': '3306',         # 数据库使用的端口
        'OPTIONS':{'init_command':'SET sql_mode="traditional",default_storage_engine=INNODB;'}  #设置数据库为INNODB,为第三方数据库登录用
    }
}

即,修改一下OPTIONS配置即可

 

 

 

参考网址:https://blog.csdn.net/jaket5219999/article/details/77849213

      http://www.testpub.cn/t/116

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2021-09-15
  • 2022-02-08
  • 2021-04-11
猜你喜欢
  • 2022-01-18
  • 2021-06-25
  • 2022-12-23
  • 2021-10-18
  • 2021-10-29
  • 2021-11-07
  • 2022-12-23
相关资源
相似解决方案