| 12345678910111213141516171819202122232425 |
- #!/bin/bash
- set -e
- echo "==> Running migrations..."
- python manage.py migrate --noinput
- echo "==> Collecting static files..."
- python manage.py collectstatic --noinput 2>/dev/null || true
- echo "==> Creating default admin user..."
- python manage.py shell << EOF
- from assetapp.models import User
- if not User.objects.filter(username='admin').exists():
- User.objects.create_superuser('admin', 'admin@example.com', 'admin123')
- print('Admin user created: admin/admin123')
- else:
- print('Admin user already exists')
- EOF
- echo "==> Starting server..."
- if [ "$1" = "gunicorn" ]; then
- exec gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 3
- else
- exec python manage.py runserver 0.0.0.0:8000
- fi
|