1
我是新Django的開始搞亂了一些事情,看看發生了什麼事會的事情是我有點現在搞砸了,並希望得到幫助。KeyError異常:U「遷移rango.0002_auto_20150905_0345依賴引用不存在的父節點
我手動刪除了一些遷移,然後運行
manage.py squashmigrations app migration_name
而且改變了一些遷移,然後再次運行該命令。 的事情是我現在面臨的這個小錯誤。最後遷移引用另外一個爲父母但現在不存在。
(kali)[email protected]:~/Poker/tango_with_django_project$ sudo python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 63, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 17, in __init__
self.loader = MigrationLoader(self.connection)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/loader.py", line 48, in __init__
self.build_graph()
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/loader.py", line 237, in build_graph
self.graph.add_dependency(migration, key, parent)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/graph.py", line 46, in add_dependency
"Migration %s dependencies reference nonexistent parent node %r" % (migration, parent)
KeyError: u"Migration rango.0002_auto_20150905_0345 dependencies reference nonexistent parent node (u'rango', u'0001_squashed_0004_auto_20150904_2325')"
您是否刪除了遷移文件? – Gocht
@Gocht我做了,現在該如何解決? – Juanvulcano
看到這個http://stackoverflow.com/questions/29355202/accidentally-deleted-my-django-south-migration-directory – Gocht