File indexing completed on 2026-06-04 08:56:29
0001
0002 set -e
0003
0004 echo "==> Waiting for PostgreSQL …"
0005 until python -c "
0006 import socket, sys, os
0007 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
0008 try:
0009 s.connect((os.environ.get('DB_HOST','db'), int(os.environ.get('DB_PORT','5432'))))
0010 s.close()
0011 sys.exit(0)
0012 except Exception:
0013 sys.exit(1)
0014 " 2>/dev/null; do
0015 sleep 1
0016 done
0017 echo "==> PostgreSQL is up."
0018
0019 echo "==> Running database migrations …"
0020 python manage.py migrate --noinput
0021
0022 echo "==> Creating Django superuser (if configured) …"
0023 if [ -n "$DJANGO_SUPERUSER_USERNAME" ] && [ -n "$DJANGO_SUPERUSER_PASSWORD" ]; then
0024 python manage.py createsuperuser --noinput 2>/dev/null || true
0025 else
0026 echo " Skipped — DJANGO_SUPERUSER_USERNAME or DJANGO_SUPERUSER_PASSWORD not set."
0027 fi
0028
0029 echo "==> Collecting static files …"
0030 python manage.py collectstatic --noinput 2>/dev/null || true
0031
0032 echo "==> Starting server …"
0033 exec "$@"