#!/bin/bash set -euo pipefail log() { echo "[ENTRYPOINT] $1" } log "Boot sequence started at $(date -u +"%Y-%m-%d %H:%M:%S UTC")" if [[ -z "${DATABASE_URL:-}" ]]; then log "DATABASE_URL is empty -> Django will fallback to POSTGRES_* or SQLite" else log "DATABASE_URL detected (length: ${#DATABASE_URL})" fi cd /app log "Running migrations..." python hue_portal/manage.py migrate --noinput log "Migrations completed." log "Ensuring cache table exists..." python hue_portal/manage.py createcachetable log "Cache table ready." log "Starting Gunicorn on port ${PORT:-7860}..." exec gunicorn hue_portal.hue_portal.wsgi:application --bind 0.0.0.0:${PORT:-7860}