django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')

Hi I am trying to get my Django 1.11.23 project running. The same code worked just fine in my local virtual machine. Now when I run "python migrate" i get the following error:

django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')

I searched the forums for an answer to this, but to the best of my knowledge, did not find any. Also, I did not post the stacktrace, because I wanted to know if it has something to do with InnoDb or MyIsam.

Any pointers or direction will be very much appreciated. Thanks.

I don't think it's anything to do with the database storage engine. The full stack trace would be helpful, though.

I'm running into the same problem today. I have just made the migration locally and it worked, then I came to python anywhere to run the migration and it gave me this error. In my case it is a existing table I have and I added a field ManyToMany to a table that already exist.

Could you post the full stack trace?

Ah, I see that you did in a new forum thread. I'll answer there.