#!/bin/bash

# Hata durumunda durdurma, çünkü ctrl+c ile kapatmak isteyebiliriz
# set -e

echo "Starting Django Development Server and Celery Worker..."

# Trap SIGINT (Ctrl+C) to kill all background processes
trap 'kill $(jobs -p)' SIGINT

# Start Celery Worker in background
echo "Starting Celery Worker..."
celery -A core worker -l info &

# Wait a bit for Celery to initialize (optional)
sleep 2

# Start Django Development Server
echo "Starting Django Server..."
python manage.py runserver 0.0.0.0:8000

# Wait for all background processes to finish
wait
