#!/bin/bash echo "Waiting for PostgreSQL..." sleep 5 echo "Running migrations..." python manage.py migrate --noinput || { echo "Migration failed!" exit 1 } echo "Creating default groups..." python manage.py create_groups || { echo "Group creation failed!" exit 1 } echo "Setting up social applications..." python manage.py setup_social_apps || { echo "Social apps setup failed!" exit 1 } echo "Skipping Tailwind build at runtime (already built during Docker build)..." # Note: Tailwind CSS is built during the Docker build process to avoid permission issues echo "🔍 Debugging Django settings..." python manage.py debug_settings echo "Collecting static files..." # Handle potential permission issues with Docker volumes # Try to collect static files, but don't fail if it doesn't work since we have build-time static files set +e python manage.py collectstatic --noinput --clear 2>/dev/null if [ $? -eq 0 ]; then echo "✅ Static files collected successfully!" else echo "⚠️ Static file collection failed due to permission issues." echo "This is common with Docker volume mounts on deployment platforms." echo "The application will use static files collected during the Docker build." echo "Your app will work normally with build-time static files." fi # Re-enable exit-on-error for the rest of the script set -e echo "Starting application..." exec "$@"