Django Migration Error - NodeNotFoundError [英] Django Migration Error - NodeNotFoundError

查看:912
本文介绍了Django Migration Error - NodeNotFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Django verstion 1.8

Django verstion 1.8

尝试在我的项目中迁移新添加的应用程序。以下是追溯错误:

Trying to migrate a newly added app in my project. Here is the traceback error:

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 354, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 346, 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 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/makemigrations.py", line 63, in handle
    loader = MigrationLoader(None, ignore_no_migrations=True)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/loader.py", line 47, in __init__
    self.build_graph()
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/loader.py", line 318, in build_graph
    _reraise_missing_dependency(migration, parent, e)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/loader.py", line 288, in _reraise_missing_dependency
    raise exc
django.db.migrations.graph.NodeNotFoundError: Migration weather.0001_initial dependencies reference nonexistent parent node (u'machines', u'0006_auto_20150921_1327')

我在研究中没有找到太多有用的信息。语法在所有型号中都是正确的。这是没有意义的:这只是一个工作项目的副本。所以它适用于一台电脑,但不在这里。模型引用的机器已经创建并正在运行。有任何想法吗???

I have not found much helpful information in researching this. Syntax is correct in all models. Here is what doesn't make sense: this is just a copy of a working project. So it works on one computer, but not here. The machines model it's referencing has already been created and is working. Any ideas???

推荐答案

您正在收到错误,因为您尝试运行的迁移, weather.0001_initial ,取决于迁移 machines.0006_auto_20150921_1327 不存在。

You are getting the error because the migration you are trying to run, weather.0001_initial, depends on a migration machines.0006_auto_20150921_1327 which does not exist.

如果可以' t找到缺少的迁移文件,您必须删除并重新创建 weather 应用程序的迁移,以便它们不依赖于缺少的迁移。

If you can't find the missing migration file, you'll have to delete and recreate the migrations for the weather app, so that they don't depend on the missing migration.

这篇关于Django Migration Error - NodeNotFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆