Django migrate Killed every time

Viewed 955

I uploaded an update to my production server. Every time I run migrate (python manage.py migrate), which took only a few seconds on my development machine, it hangs for a long time and then simply says "Killed".

This also bounces me out of the pipenv shell. I have tried using the migrate flags --list, --plan, and --fake, but they all do the same thing, hang and then "Killed." I accidentally ran makemigrations on the production machine first. Is that what screwed it up? How can I find out what is killing the process? And how can I fix it?

I desperately need to update the database to run the code that got installed. I have checked the database and none of the changes have been made. Also the migration files in the app have not been corrupted either. I am at a loss here.

Frank

3 Answers

Yes, it turned out to be a memory issue. I did not realize I was running in such a tight environment on my Digital Ocean droplet. I increased the memory size using their web interface and all is fine now. Thanks for everyone who at least considered my issue and to Erwin for suggesting that it was a memory issue.

Can you run python manage.py migrate -v 3 to make the output more verbose and see if you can find anything from there.

And did you make sure to stop the Django process (e.g. gunicorn) before migrating? On your local machine when using runserver it won't matter much, but in production using for example gunicorn, the database may be locked.

most probably you set the DEBUG to True, it will log lots of actions and consume all resources, set it to False and you'll notice significant difference in performance.

as a side note: try all args of command, see makemigrations/migrate --help

Related