I would like Django to automatically apply migrations when server starts. How to do it?
I serve django with uwsgi - actually as one of emperor applications.
After publishing new version, I change wsgi.ini file and emperor restarts whole service. But database is not migrated.
But when running tests - locally - by manage.py the migrations are apllied to the database.
Currently the only idea I have is to call subprocess.check_output("manage.py migrate") from settings.py.
The problem here is that calling system command is dependent on system environment. Additionally wsgi is usually running on virtual env.
I could be missing something but is must be possible to run migrations from within the starting code of server.