简体   繁体   中英

django.db.migrations.exceptions.NodeNotFoundError: upon running "python manage.py migrate"

I have just started a new django project, which is my own blog. I ran this command first:

django-admin startproject mysite

Then:

python manage.py migrate

But, upon running python manage.py migrate , I am getting this error:

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\commands\migrate.py", line 86, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\migrations\loader.py", line 49, in __init__
    self.build_graph()
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\migrations\loader.py", line 274, in build_graph
    raise exc
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\migrations\loader.py", line 248, in build_graph
    self.graph.validate_consistency()
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\migrations\graph.py", line 195, in validate_consistency
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\migrations\graph.py", line 195, in <listcomp>
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "C:\Users\Padma Jain\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\migrations\graph.py", line 58, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration auth.0012_user_following dependencies reference nonexistent parent node ('account', '0002_contact')

I haven't even written any code yet. Then why am I getting this error? Please help me out

It's probably corrupted file when installing django. Try re-installing your django since that's django's migrations file that is missing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM