modern-django-starter/entrypoint.sh
amitrana01 23f9778964 Add debugging for environment variables and Django settings
- Fix production.py settings to properly read environment variables with defaults
- Add debug_settings management command to troubleshoot environment variable issues
- Add debugging output to entrypoint.sh to see what settings are loaded
- This will help identify why ALLOWED_HOSTS and CSRF_TRUSTED_ORIGINS may not be working
2025-09-11 18:04:23 +05:30

49 lines
1.4 KiB
Bash
Executable File

#!/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 "$@"