djangosyncdb

Django 1.8, syncdb not working, throwing a foreign key constraint error


Since I upgrade to Django 1.8 from 1.7, I have got this foreign key constraint error.

File "c:project\env\lib\site-packages\mysql_python-1.2.5-py2.7-win32.egg/MySQLdb\connections.py line 36, in defaulterrorhandler raise errorclass, errorvalue, 

Django.db.utils.IntergrityError: 'Cannot add foreing key contraint

What's some wrong with django 1.8 (latest version)?


Solution

  • Try this

    DATABASES = {
    'default': {
        ...         
        'OPTIONS': {
             "init_command": "SET foreign_key_checks = 0;",
        },
        'STORAGE_ENGINE': 'MyISAM / INNODB / ETC'
     }
    }