Django: dependencies reference nonexistent parent node

本小妞迷上赌 提交于 2019-12-03 09:28:25
NIKHIL RANE

Solution - 1

Remove pyc files from your migrations folder.

Solution - 2

Need to remove that reference from testBolt.0001_initial by editing migration file.

Solution - 3

  1. Remove the new changes from the models and run python manage.py migrate --fake

  2. Now again modify your models with new changes

  3. Run python manage.py makemigrations

  4. And then again run python manage.py migrate

I had the same problem. In my case, because I played with migrations manually, I forgot to create __init__.py inside of migrations folder.

I had a similar case, running django in windows in a virtual env. In my case the missing dependency was 0001_initial - which was definitely there in the migration folder.

The 'solution' was to remove the pyc files and do another migrate attempt.

In my case, I had the .py extension in the dependency module name, like this:

dependencies = [
    ('dashboard', '0003_auto_20181024_0603.py'),
    ('auth', '__latest__'),
    ('contenttypes', '__latest__'),
]

I removed the .py, changing it to this

    ('dashboard', '0003_auto_20181024_0603')

and that fixed it.

Make sure that you have activated your virtual environment.

KeyError: u"Migration testBolt.0001_initial dependencies reference nonexistent parent node (u'delivery_boy', u'0004_auto_20150221_2011')"

Remove

testBolt.0001_initial

then run migrate again

There could be some migration files remaining in the app when you tried the migrate command. First remove all migrations directories from all the modules. For other cases Nikhil Rane has covered it all.

I tried NIKHIL's solutions with no luck. What did work for me was:

  • Removing my virtual environment
  • Deleting the migration __pycache__ folders
  • Deleting old migrations
  • Recreating my virtual environment
  • Running migrations
Lê Hoàng Vũ

This works for me In your app migrations folder

  1. Delete all the files pyc in your app folder (except the __init__)
  2. Delete all the files in the migrations (except the __init__ )

  3. python manage.py makemigrations

  4. python manage.py migrate
  5. runserver

I had moved around my virtual environment folder.so I moved it back where it was, worked for me.

KENOSIN

I'll show you the solution the follow.

1

pip3 install django==2.2 --user

2

python manage.py runserver

That's it.You might want to use django the version over 2.2 at least.I fixed the same error(a part of content is different),after I typed the command.

Performing system checks...

System check identified no issues (0 silenced).
Unhandled exception in thread started by <function check_errors.<locals>.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 <listcomp>
    [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')
Sreenath K Menon

Go to folder testBolt -> migrations and remove 0001_initial py and pyc files.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!