first commit
This commit is contained in:
31
entrypoint.sh
Normal file
31
entrypoint.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/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 "$@"
|
||||
Reference in New Issue
Block a user