问题
How can I run python manage.py makemigrations
and python manage.py migrate
automatically when deploying a Django app to Heroku via CircleCI. It seems all commands run local to CircleCI, but not on the deployed application in production.
Is there a way?
回答1:
python manage.py makemigrations
should be running locally, and you may commit the migration files along with the code.
Regaridng the migrations, open your Procfile
and add this line: release: python manage.py migrate
.
This will tell Heroku to migrate before deploying a new version of your code.
来源:https://stackoverflow.com/questions/44267994/deploying-django-app-to-heroku-via-circleci-how-to-migrate-database