我在 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')
最佳答案
我已经想通了这个问题。我确实进入了 django/django/contrib/auth/migrations/
并意识到缺少迁移文件。
由此,我意识到我必须卸载 django 并重新安装
它,您将不再遇到该错误。
关于django.db.migrations.exceptions.NodeNotFoundError 迁移认证不存在的父节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49344433/