【问题标题】:Error: Migration dependencies reference nonexistent parent node错误:迁移依赖项引用不存在的父节点
【发布时间】:2021-01-14 14:30:19
【问题描述】:

当我使用 Sudo 权限运行迁移时出现此错误:

  File "/home/dell/.local/lib/python3.6/site-packages/django/db/migrations/graph.py", line 58, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration auth.0013_auto_20210105_1445 dependencies reference nonexistent parent node ('auth', '0012_alter_user_first_name_max_length')

【问题讨论】:

  • 请发布您的代码。
  • 您的代码可能有问题,我们需要您发布相关代码来帮助您
  • 您的最新迁移 0013_auto_20210105_1445 似乎引用了之前的迁移 0012_alter_user_first_name_max_length,由于某种原因不再存在。也许你已经删除了它?

标签: python django django-migrations


【解决方案1】:

当我从 django 升级时发生在我身上

V3.0.2

V3.2.3

然后再次降级

V3.0.2

我通过删除迁移文件解决了冲突 - 在你的情况下,它将是 0013_auto_20210105_1445.py- 女巫位于 - 在我的情况下 - 在

PATH/TO/VIRTUAL_ENV/lib64/python3.8/site-packages/django/contrib/auth/migrations

【讨论】:

    【解决方案2】:

    你需要删除这个迁移,因为它最后依赖了

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-26
    • 1970-01-01
    • 2017-10-05
    • 1970-01-01
    • 2015-04-24
    • 1970-01-01
    • 2015-12-01
    相关资源
    最近更新 更多