Skip to content
Advertisement

Django migrations error KeyError: (‘list’, u’user’)

I am trying to run

JavaScript

or

JavaScript

I got this error:

JavaScript

It happen after I pulled another version of my app from the git.

I don’t have this error with the same code on the another machine. I’ve tried to use --fake with zero or to squashmigrations to previous but this also doesn’t help.

Cannot get how to solve it.

Advertisement

Answer

The problem was in migration files. While I was making commit into git somehow I’ve deleted one of the migration files, so the order was like 0001 0003 0004 without 0002. In the second migration file I’ve created a model named user.

The problem was that when I run python manage.py migrate django could not find the place where the model named user has been created (this model has been created in 0002 file).

I solved it by manually adding this code to the 0001 migration file:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement