Adds the full Django application layer on top of sportstime_parser: - core: Sport, Team, Stadium, Game models with aliases and league structure - scraper: orchestration engine, adapter, job management, Celery tasks - cloudkit: CloudKit sync client, sync state tracking, sync jobs - dashboard: staff dashboard for monitoring scrapers, sync, review queue - notifications: email reports for scrape/sync results - Docker setup for deployment (Dockerfile, docker-compose, entrypoint) Game exports now use game_datetime_utc (ISO 8601 UTC) instead of venue-local date+time strings, matching the canonical format used by the iOS app. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
1.3 KiB
Bash
46 lines
1.3 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# Wait for database to be ready
|
|
echo "Waiting for PostgreSQL..."
|
|
while ! nc -z $POSTGRES_HOST ${POSTGRES_PORT:-5432}; do
|
|
sleep 1
|
|
done
|
|
echo "PostgreSQL is ready!"
|
|
|
|
# Run migrations
|
|
echo "Running migrations..."
|
|
python manage.py migrate --noinput
|
|
|
|
# Collect static files (skip in DEBUG mode - Django serves them directly)
|
|
if [ "$DEBUG" != "True" ]; then
|
|
echo "Collecting static files..."
|
|
python manage.py collectstatic --noinput
|
|
else
|
|
echo "DEBUG mode - skipping collectstatic"
|
|
fi
|
|
|
|
# Create superuser if not exists
|
|
if [ -n "$DJANGO_SUPERUSER_USERNAME" ] && [ -n "$DJANGO_SUPERUSER_PASSWORD" ] && [ -n "$DJANGO_SUPERUSER_EMAIL" ]; then
|
|
echo "Creating superuser..."
|
|
python manage.py shell << EOF
|
|
from django.contrib.auth import get_user_model
|
|
User = get_user_model()
|
|
if not User.objects.filter(username='$DJANGO_SUPERUSER_USERNAME').exists():
|
|
User.objects.create_superuser('$DJANGO_SUPERUSER_USERNAME', '$DJANGO_SUPERUSER_EMAIL', '$DJANGO_SUPERUSER_PASSWORD')
|
|
print('Superuser created successfully')
|
|
else:
|
|
print('Superuser already exists')
|
|
EOF
|
|
fi
|
|
|
|
# Import initial data if flag is set
|
|
if [ "$IMPORT_INITIAL_DATA" = "true" ]; then
|
|
echo "Importing initial data..."
|
|
python manage.py import_data --data-dir=/app --output-dir=/app/output || true
|
|
fi
|
|
|
|
# Start the server
|
|
echo "Starting server..."
|
|
exec "$@"
|