Running migrations when deploying django app to heroku with codeship

穿精又带淫゛_ 提交于 2019-12-08 07:12:42

问题


I'm trying to set up a continous integration pipeline for my python 3.5.1 / django 1.9.7 project.

The project is running fine on heroku, and the codeship deployment pipeline for heroku works well as long as my database is unchanged.

If I want to run migrations, I have to do so manually by entering heroku run python manage.py migrate on my computer which I would like to avoid.

I added a "Custom Script" in my codeship deployment pipeline after the "heroku"-pipeline containing heroku run python manage.py migrate, but when coedship attempts to execute it, it fails with the

Cannot run more than 1 Free size dynos.

message. I assume this is because the server is already up and running and I don't have more worker processes available? (please correct me if I'm wrong) EDIT: This is where I was wrong - I had an additional process running (see answer)

Is there any way to include the database migration step in the heroku deployment pipeline? Or did I do something wrong?


回答1:


Ifound the answer here: Heroku: Cannot run more than 1 Free size dynos

My assumption about theweb server beeing the blocking dyno was wrong, I had a zombie process (createsuperuser) running I did not know about.

I used heroku ps to show all running prcesses. Output was:

=== web (Free): gunicorn my_app.wsgi --log-file - (1)
web.1: idle 2016/06/07 17:09:06 +0200 (~ 13h ago)

=== run: one-off processes (1)
run.7012 (Free): up 2016/06/07 15:19:13 +0200 (~ 15h ago): python manage.py createsuperuser

I killed the process by typing

heroku ps:stop run.7012

and afterwards my migration via codeship custom script worked as expected.



来源:https://stackoverflow.com/questions/37683102/running-migrations-when-deploying-django-app-to-heroku-with-codeship

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