Files
shopback/entrypoint.sh
Beyhan Oğur d9f1ea341e first commit
2026-04-26 22:27:56 +03:00

32 lines
924 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Hata durumunda scripti durdur
set -e
# PostgreSQL bağlantısını kontrol et (mevcut sunucu için)
echo "Checking PostgreSQL connection..."
# Not: Mevcut PostgreSQL sunucunuz zaten çalışıyor olmalı (10.80.80.50:5432)
# 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 "$@"