Performing migrations when deploying django application for heroku using codes

I am trying to set up a continuous integration pipeline for my python 3.5.1 / django 1.9.7 project.

The project works fine on heroku, and the code deployment pipeline for heroku works well until my database changes.

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

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

Cannot run more than 1 Free size dynos.

message. I assume this is because the server is already running and I have no workflows? (please correct me if I am wrong) EDIT: Here I was wrong - I had an additional process (see answer)

Can I include the database migration step in the heroku deployment pipeline? Or did I do something wrong?

+1
django heroku codeship
Jun 07 '16 at 15:09
source share
1 answer

In this case, the answer is: Heroku: cannot run more than 1 free dynamic sizes

My assumption that the server-server located on the blocking dyno is wrong, I had a process of zombies (createuperuser), which I did not know.

I used heroku ps to show all running processes. The 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 then my migration through the script user interface, which works as usual.

+3
Jun 08 '16 at 4:33
source share



All Articles