I have set up a Docker Django/PostgreSQL app closely following the Django Quick Start instructions on the Docker site.
The first time I run Django\'s manage.py migr
I know this is old, and maybe I am missing something here (if so, please enlighten me!), but why not just add the commands to your start.sh script, run by Docker to fire up your instance? It will take only a few extra seconds.
N.B. I set the DJANGO_SETTINGS_MODULE variable to make sure the correct database is used, as I use different databases for development and production (although I know this is not 'best practice').
This solved it for me:
#!/bin/bash
# Migrate the database first
echo "Migrating the database before starting the server"
export DJANGO_SETTINGS_MODULE="edatool.settings.production"
python manage.py makemigrations
python manage.py migrate
# Start Gunicorn processes
echo "Starting Gunicorn."
exec gunicorn edatool.wsgi:application \
--bind 0.0.0.0:8000 \
--workers 3