11

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???

Nicoale
  • 503
  • 2
  • 10
  • 23
  • Does the required migration file `machines/migrations/0006_auto_20150921_1327.py` exist? – Alasdair Nov 12 '15 at 16:19
  • I don't think it does... I was using an older version of Django and never had to create migrations files before, so I don't know if this is "new" or not. It is to me anyhow... :) Researching it now and came across the same thing - having to create a migration file. – Nicoale Nov 12 '15 at 16:21

2 Answers2

12

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.

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.

Alasdair
  • 298,606
  • 55
  • 578
  • 516
  • That's exactly what I had to do. A migration directory had been created. So I deleted it and ran the migration. The new migration was able to be processed and everything works well now. Thanks!!! – Nicoale Nov 12 '15 at 19:07
0

You are getting this error because you are missing the

__init__.py

file in your migrations folder.

For me, it worked after adding this file.