django.db.migrations.exceptions.NodeNotFoundError: Migration auth.0013_user_following dependencies reference nonexistent parent node (‘users’, ‘0002_contact’)

按照 https://stackoverflow.com/questions/37937343/django-db-migrations-exceptions-nodenotfounderror的步骤即可,在生产环境中也不会删除原来的重要数据。

If it not solve after reseting the migrations, follow the following steps: Apparently django kept migration files within it’s own module folder. This is why you need to flush the django:

  1. pip uninstall django.
  2. /Lib/site-packages, deleted django folder.
  3. Deleted all *.pyc files in my project.
  4. Deleted all pycache folders in my project.
  5. Cleared all migrations folders in my project (keep init.py).
  6. pip install django==x.x.x.
  7. python manage.py migrate.
  8. python manage.py makemigrations <app_name>.
  9. python manage.py migrate.
  10. python manage.py runserver. Now your problem will be solved.