I'm deploying on a free Heroku dyno.
This is my Procfile:
release: python manage.py migrate
web: gunicorn app.wsgi --log-file -
I've already made migrations locally and I'm deploying through Github. I figured out that the line release: python manage.py migrate
indeed runs the command on the dyno but doesn't create tables(I've confirmed this by getting into the command line of my Dyno using heroku run bash
and then check if there are any tables in the db.sqlite3
file. There were none. I rerun the migrate
command using the Heroku bash and then the tables were populated in the db.sqlite3
file. I exited the console, reload my app and tried to login again but it threw the same error, yet again: django.db.utils.OperationalError: no such table: auth_user
. I logged into Heroku bash again and saw that the tables that I've created in the db.sqlite3
file are not there anymore.
Heroku uses ephemeral filesystem. Since SQLite is stored as a file inside the project folder,you can't expect it to be there permanently. Only project files will remain untouched. Any files created by your code will be deleted regularly (max 24hours) Any type of storage should be done using S3 (for static files). For database,you should use the database service provided by heroku (I use Postgres).