ValueError: Related model u'app.model' cannot be resolved

Because You have ForeignKey in operations, You must add a ook to dependencies:

dependencies = [
    ('ook', '__first__'),
    ('eek', '0002_auto_20151029_1040'),
]

Django migrations have two "magic" values:

  • __first__ - get module first migration
  • __latest__ - get module latest migration

Try running migrations one by one for every model.

This way you can debug the app you are facing problem with

python manage.py migrate appmname

I just got the same error, but referring to a model that was declared as part of the same migration. It turned out that the first migrations.CreateModel(...) referred to a not yet declared model. I manually moved this below the declaration of the referred model and then everything worked fine.