django.db.migrations.exceptions.InconsistentMigrationHistory

后端 未结 25 1198
耶瑟儿~
耶瑟儿~ 2020-12-04 08:16

When I run python manage.py migrate on my Django project, I get the following error:

Traceback (most recent call last):
File \"manage.py\", line         


        
25条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 09:02

    Your django_migrations table in your database is the cause of inconsistency and deleting all the migrations just from local path won't work.

    You have to truncate the django_migrations table from your database and then try applying the migrations again. It should work but if it does not then run makemigrations again and then migrate.

    Note: don't forget to take a backup of your data.

提交回复
热议问题