#!/bin/bash set -e echo "Waiting for PostgreSQL..." while ! nc -z "$DB_HOST" "$DB_PORT" 2>/dev/null; do sleep 1 done echo "PostgreSQL is ready." echo "Running migrations..." python manage.py migrate --noinput || true echo "Collecting static files..." python manage.py collectstatic --noinput if [ "$#" -gt 0 ]; then echo "Executing command: $*" exec "$@" fi echo "Starting Gunicorn..." exec gunicorn --bind 0.0.0.0:8000 \ --workers 2 \ --timeout 300 \ --access-logfile - \ dsp_platform.wsgi:application