Skip to content

Instantly share code, notes, and snippets.

@kylefox
Last active October 23, 2020 08:42
Show Gist options
  • Save kylefox/7044491259b6b2586ca1 to your computer and use it in GitHub Desktop.
Save kylefox/7044491259b6b2586ca1 to your computer and use it in GitHub Desktop.
Run Django database migrations after deploy to Heroku. This file must live at `bin/post_compile` within your root project directory.
# !/usr/bin/env bash
# File path should be ./bin/post_compile
# (.sh extension added in Gist just to enable shell syntax highlighting.
# https://discussion.heroku.com/t/django-automaticlly-run-syncdb-and-migrations-after-heroku-deploy-with-a-buildpack-or-otherwise/466/7
echo "=> Performing database migrations..."
python manage.py migrate
@segunisreal
Copy link

segunisreal commented Jun 10, 2020

Just do:

release: python manage.py migrate --no-input
web: gunicorn project_name.wsgi

and you will be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment