小编Jaa*_*cob的帖子

Django 迁移 - django.db.migrations.exceptions.NodeNotFoundError

运行任何 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 migration django manage.py

7
推荐指数
1
解决办法
4157
查看次数

标签 统计

django ×1

manage.py ×1

migration ×1

python ×1