modern-django-starter/startup.sh
amitrana01 3827944aa5 Add bulletproof startup script to fix django_site migration issues
- Create startup.sh with proper step-by-step setup and clear logging
- Explicit sites migration before configure_site command
- Better error handling with set -e
- Clean command structure in docker-compose
- This should resolve the 'relation django_site does not exist' error

The startup script runs migrations in correct order and provides clear feedback.
2025-09-11 18:42:15 +05:30

32 lines
815 B
Bash
Executable File

#!/bin/bash
set -e
echo "🚀 Starting Django application setup..."
echo "⏳ Waiting for database..."
sleep 5
echo "📦 Running database migrations..."
python manage.py migrate --noinput
echo "🌐 Ensuring Sites framework is set up..."
python manage.py migrate sites --noinput
echo "👥 Creating user groups..."
python manage.py create_groups
echo "🔗 Setting up social applications..."
python manage.py setup_social_apps
echo "🏠 Configuring site domain..."
python manage.py configure_site --domain=dt.netcoptech.com --name="Django Template"
echo "📁 Collecting static files..."
python manage.py collectstatic --noinput
echo "✅ Setup completed successfully!"
echo "🚀 Starting Gunicorn server..."
exec gunicorn --bind 0.0.0.0:8000 --workers 3 --timeout 120 django_project.wsgi:application