其他分享
首页 > 其他分享> > 外键约束问题:django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')报错

外键约束问题:django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')报错

作者:互联网

img

[外键约束问题]django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')

DATABASES= {

    'default': {

        'ENGINE': 'django.db.backends.mysql',

        'NAME': 'ebusiness',

        'USER':'root',

        'PASSWORD':'123456',

        'HOST':'localhost',

        'PORT':'3306',
		# 加下面这个
        'OPTIONS': {

            "init_command": "SET foreign_key_checks = 0;",

        }  # 加入这个在setting.py文件中数据库配置信息中
    }
}

标签:constraint,utils,db,django,Cannot,报错,key,foreign
来源: https://www.cnblogs.com/zonghan/p/16220826.html