【发布时间】:2015-12-01 06:44:06
【问题描述】:
我是 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')"
【问题讨论】:
-
您是否删除了迁移文件?
-
@Gocht 我做到了,我现在该如何解决?
-
@Gocht 我正在使用 Django 1.7,似乎找不到架构迁移,还有什么我可以做的吗?
-
再次使用 --fake 和 makemigrations