django.db.migrations.exceptions.NodeNotFoundError迁移认证不存在的父节点

时间:2018-03-18 04:17:23

标签: django django-models

我在django上运行我的代码,我遇到了这个问题。可能是什么问题?我正在使用django 2.0.2

  Performing system checks...

System check identified no issues (0 silenced).
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f6ead6dcea0>
Traceback (most recent call last):
  File "/home/geek/PycharmProjects/hadhari/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/home/geek/PycharmProjects/hadhari/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 128, in inner_run
    self.check_migrations()
  File "/home/geek/PycharmProjects/hadhari/venv/lib/python3.6/site-packages/django/core/management/base.py", line 422, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/home/geek/PycharmProjects/hadhari/venv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/home/geek/PycharmProjects/hadhari/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 52, in __init__
    self.build_graph()
  File "/home/geek/PycharmProjects/hadhari/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 274, in build_graph
    raise exc
  File "/home/geek/PycharmProjects/hadhari/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 244, in build_graph
    self.graph.validate_consistency()
  File "/home/geek/PycharmProjects/hadhari/venv/lib/python3.6/site-packages/django/db/migrations/graph.py", line 261, in validate_consistency
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "/home/geek/PycharmProjects/hadhari/venv/lib/python3.6/site-packages/django/db/migrations/graph.py", line 261, in <listcomp>
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "/home/geek/PycharmProjects/hadhari/venv/lib/python3.6/site-packages/django/db/migrations/graph.py", line 104, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration authentication.0001_initial dependencies reference nonexistent parent node ('auth', '0009_alter_user_last_name_max_length')

1 个答案:

答案 0 :(得分:1)

我已经找到了问题所在。我确实进入django/django/contrib/auth/migrations/并意识到迁移文件丢失了。

从此我意识到我必须卸载django并重新安装它,问题将消失,因为迁移现在可用。