How do you force Django to create real foreign key constraints when using a MySQL backend? If I'm reading this old bug report correctly, Django shou开发者_JS百科ld be creating real foreign keys, but my default Django 1.2.3 setup using MySQL only generates indexes for models.ForeignKey().
Change your database engine to InnoDB. MyISAM doesn't support foreign keys.
I'm running on Django 1.2.1 with MySQL_python-1.2.3c and can verify that it is indeed creating proper foreign key entries on MySQL.
I suggest that you check if you are using MySQL_python-1.2.3c or better
精彩评论