django错误django.db.migrations.exceptions.NodeNotFoundError:迁移app.0001_initial的依赖引用不存在的父节点(’auth’,’0011_update_proxy_permissions’)
如果在Django中遇到以下错误,可能是因为引用了不存在的父节点(本例中是auth)。
django.db.migrations.exceptions.NodeNotFoundError: Migration app.0001_initial dependencies reference nonexistent parent node ('auth', '0011_update_proxy_permissions')
在这种情况下,升级Django版本至2.2以上可能会修复问题。对于本次情况而言,可以考虑升级至2.2.4版本。
将django版本升级至2.2.4。
pip3 install django==2.2.4 --user
在manage.py所在的位置运行runserver。
python manage.py runserver
一切顺利地运行了runserver和migrate。
C:\Users\hoge\Desktop\hoge\hoge>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 27, 2019 - 08:15:33
Django version 2.2.4, using settings 'hoge.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
补充三项
为您提供错误列表作为参考。
Performing system checks...
System check identified no issues (0 silenced). Unhandled exception in thread started by .wrapper at 0x0000029C0D0D3EA0> Traceback (most recent call last): File "C:\Users\hogeuser\AppData\Roaming\Python\Python36\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "C:\Users\hogeuser\AppData\Roaming\Python\Python36\site-packages\django\core\management\commands\runserver.py", line 120, in inner_run self.check_migrations() File "C:\Users\hogeuser\AppData\Roaming\Python\Python36\site-packages\django\core\management\base.py", line 442, in check_migrations executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS]) File "C:\Users\hogeuser\AppData\Roaming\Python\Python36\site-packages\django\db\migrations\executor.py", line 18, in init self.loader = MigrationLoader(self.connection) File "C:\Users\hogeuser\AppData\Roaming\Python\Python36\site-packages\django\db\migrations\loader.py", line 49, in init self.build_graph() File "C:\Users\hogeuser\AppData\Roaming\Python\Python36\site-packages\django\db\migrations\loader.py", line 273, in build_graph raise exc File "C:\Users\hogeuser\AppData\Roaming\Python\Python36\site-packages\django\db\migrations\loader.py", line 247, in build_graph self.graph.validate_consistency() File "C:\Users\hogeuser\AppData\Roaming\Python\Python36\site-packages\django\db\migrations\graph.py", line 243, in validate_consistency [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)] File "C:\Users\hogeuser\AppData\Roaming\Python\Python36\site-packages\django\db\migrations\graph.py", line 243, in [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)] File "C:\Users\hogeuser\AppData\Roaming\Python\Python36\site-packages\django\db\migrations\graph.py", line 96, in raise_error raise NodeNotFoundError(self.error_message, self.key, origin=self.origin) django.db.migrations.exceptions.NodeNotFoundError: Migration app.0001_initial dependencies reference nonexistent parent node ('auth', '0011_update_proxy_permissions')