我是django的新手,并开始弄乱一些东西,看看会发生什么。问题是我现在有点搞砸了,我会很感激帮助。
我手动删除了一些迁移,然后运行
manage.py squashmigrations app migration_name
并更改了一些迁移,然后再次运行该命令。 现在我正面对这个小虫子。最后一次迁移将另一个迁移作为父迁移,但它现在不存在。
(kali)maker@localhost:~/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')"
答案 0 :(得分:0)
在我的情况下,
最后,它有效。