无法解析迁移文件的依赖关系

时间:2017-12-02 07:16:01

标签: django

我尝试了下面提到的所有解决方案:

  • 删除除init.py和db.sqlite3之外的所有迁移文件。之后运行makemigrations。

  • 应用虚假迁移

  • 升级django并再次进行迁移

  • 删除迁移文件夹,然后尝试

任何这个解决方案都无法帮助我。每次都会产生相同的错误(如下所述)。请帮我摆脱这个错误。

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\migrate.py", line 83, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\loader.py", line 52, in __init__
    self.build_graph()
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\loader.py", line 274, in build_graph
    raise exc
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\loader.py", line 244, in build_graph
    self.graph.validate_consistency()
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\graph.py", line 261, in validate_consistency
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\graph.py", line 261, in <listcomp>
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\graph.py", line 104, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration taggit.0003_tag_tags dependencies reference nonexistent parent node ('personal', '0006_auto_20171113_1322')

这是我的文件夹结构:Structure_Folder

1 个答案:

答案 0 :(得分:0)

尝试删除所有&#34; pycache &#34;和&#34; 迁移&#34;文件夹。然后像这样运行makemigrations:

./manage makemigrations <app_name>