Django Makemigrations And Migrate On Heroku Server Don't Create Tables
Python Version 2.7 Django Version 1.9.7 I have created a Django app on heroku. I can't get the heroku server to migrate properly. In the past I have done all the makemigrations l
Solution 1:
I had a similar problem.
I just ssh
into heroku dyno with:
heroku run bash
( from your heroku application folder ofc )
Than run all the migration and makemigration commands with createsuperuser if needed. Works with sqlite and postgre for me.
Solution 2:
- Run these commands locally
python manage.py makemigrations,,, Python manage.py migrate
2.commit your code
3.push it to heroku master
- Run
heroku run python manage.py makemigrations,,,, heroku run python manage.py migrate
Your issue should be solved
Solution 3:
I ran into the same error two times while deploying to Heroku. While listing the files under the app directory, I found out db.sqlite3 file was missing which is necessary for django to create the sql tables. While it automatically creates the file in local, it wasn't getting created on the heroku while running migrate command.
There are two options from here:
- create db.sqlite3 file on heroku under your app directory
- run "python manage.py migrate" locally to create the db.sqlite3 and push it to the heroku repo
Post a Comment for "Django Makemigrations And Migrate On Heroku Server Don't Create Tables"