Mostafa Elgayar
Mostafa Elgayar

Reputation: 352

django app keeps migrating without taking effect [heroku]

I have been trying to fix this for the past three days and I keep failing.

So, I have a simple app, that just has models.py and admin.py for now. When I migrate locally, everything is totally fine, when I run createsuperuser, I can create a user that I can use to login into the admin dashboard.

However, when I do the same on heroku. It doesn't work.. I ran makemigrations on heroku, then migrate The bad news is, those tables were never created, because this is what happens when I run migrate again: WHYY!

I literally have no idea what's wrong with it, so any help would be appreciated. Thanks in advance :)

Upvotes: 2

Views: 481

Answers (2)

Daniel Roseman
Daniel Roseman

Reputation: 599956

In addition to the problem that dnit13 mentioned, the other issue is that you are using sqlite. That can not work on Heroku. You must use a proper db, which is provided by an add-on.

Upvotes: 3

dnit13
dnit13

Reputation: 2496

Create migration files locally python manage.py makemigrations.

Add these files to git and push to heroku. (Make sure migrations are not ignoreed in .gitignore)

git add .
git commit -m "migration files"
git push heroku master  # assuming your alias to be heroku

then migrate on heroku

heroku run ./manage.py migrate

Upvotes: 3

Related Questions