32 lines
909 B
Bash
32 lines
909 B
Bash
#!/bin/bash
|
||
|
||
# Hata durumunda scripti durdur
|
||
set -e
|
||
|
||
# MySQL bağlantısını kontrol et (mevcut sunucu için)
|
||
echo "Checking MySQL connection..."
|
||
# Not: Mevcut MySQL sunucunuz zaten çalışıyor olmalı (10.80.80.70:3306)
|
||
|
||
# Veritabanı migrasyonlarını uygula
|
||
echo "Applying database migrations..."
|
||
python manage.py migrate --noinput
|
||
|
||
# Superuser oluştur (eğer yoksa)
|
||
echo "Creating superuser if it doesn't exist..."
|
||
python manage.py shell -c "
|
||
from django.contrib.auth import get_user_model
|
||
User = get_user_model()
|
||
if not User.objects.filter(email='admin@example.com').exists():
|
||
User.objects.create_superuser('admin@example.com', 'admin')
|
||
print('Superuser created: admin@example.com / admin')
|
||
else:
|
||
print('Superuser already exists')
|
||
" || true
|
||
|
||
# Static dosyaları topla
|
||
echo "Collecting static files..."
|
||
python manage.py collectstatic --noinput --clear
|
||
|
||
echo "Starting server..."
|
||
exec "$@"
|