【发布时间】:2018-11-27 17:08:42
【问题描述】:
运行任何 python manage.py 函数时出现以下错误:
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration auth.0010_user_following dependencies reference nonexistent parent node ('accounts', '0002_auto_20180615_2021')
在我尝试通过手动删除迁移文件夹中的迁移文件(init 文件除外 - 迁移文件夹中没有其他文件)来重置我的迁移之后发生这种情况。
我尝试使用 python manage.py flush 删除数据库,但它也无法运行。
有什么建议吗?谢谢!
解决方案: 经过一周的谷歌搜索,我最终使用文档手动重建了引用的迁移文件:https://docs.djangoproject.com/en/2.0/howto/writing-migrations/
之后,manage.py migrate 和 makemigration 函数再次工作。千万不要在没有先备份的情况下删除迁移文件!
【问题讨论】:
标签: python django migration manage.py