Deploying Django app to Heroku via CircleCI: How to migrate database?

佐手、 提交于 2019-12-11 14:09:41

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!