coderDcoder
coderDcoder

Reputation: 605

How do you solve django.db.migrations.exceptions.NodeNotFoundError in Django?

I get the following error when I do python manage.py makemigrations:

django.db.migrations.exceptions.NodeNotFoundError: Migration leads.0001_initial dependencies reference nonexistent parent node ('auth', '0012_alter_user_first_name_max_length')

This is a part of my 0001_initial.py:

class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            ...

How am I supposed to solve this error? Currently, I am in production. Thank you, and please leave a comment if you have any questions.

Upvotes: 0

Views: 1312

Answers (1)

zankoAN
zankoAN

Reputation: 548

Your problem is with the Django version:

Because this migration file 0012_alter_user_first_name_max_length must be in this directory: /lib/python3.*/site-packages/django/contrib/auth/migrations/ but it doesn't exist now and you will receive an error.

In your case I think you are using the oldest version of Django(< 3.1.0) and this migration file does not exist, to solve this problem you can upgrade Django version to >= 3.1.0.

Upvotes: 1

Related Questions