Deploy to Heroku PYTHON/DJANGO application giving error

Asked

Viewed 222 times

2

I made a change to the default auth of Django and my project is working properly but when I give git push Heroku master and then use the command Heroku run python Manage.py migrate to create my database and it gives the error:

Django.db.Migrations.exceptions.Nodenotfounderror: Migration Accounts.0001_initial dependencies Reference nonexis nt Parent Node ('auth', '0008_alter_user_username_max_length')

Does anyone know how to solve?

  • You are making makemigrations before migrate?

  • Good by what I know I don’t need to give a makemigrations on Heroku just migrate for bank creation

  • I refer to local makemigrations. See the answer and comments of that question, maybe I can help you.

1 answer

0

I believe your makemigrations created the "0008_alter_user_username_max_length" in the auth app folder that is not versioned along with your project. So for Heroku the dependency on your migration doesn’t really exist.

To resolve would advise you to extend the auth app. Create your own user template and set it as the default. In Settings for example:

AUTH_USER_MODEL = 'myapp.MyUser'

And in the models:

class MyUser(AbstractBaseUser):
    ...
    date_of_birth = models.DateField()
    height = models.FloatField()
    ...
    REQUIRED_FIELDS = ['date_of_birth', 'height']

https://docs.djangoproject.com/en/1.11/topics/auth/customizing/#substituting-a-custom-user-model

Browser other questions tagged

You are not signed in. Login or sign up in order to post.