-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_backend.sh
More file actions
34 lines (25 loc) · 765 Bytes
/
Copy pathrun_backend.sh
File metadata and controls
34 lines (25 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Script to set up and run the Django backend with Celery worker and beat
# Create venv if it doesn't exist
if [ ! -d "venv" ]; then
python -m venv venv
fi
# Activate venv
.\venv\Scripts\Activate.ps1
# Install requirements
pip install --upgrade pip
cd backend
pip install Pillow
pip install "click<8.1"
pip install -r requirements.txt
# Run migrations
python backend/manage.py migrate
# Start Redis (if using Docker and not already running)
if ! docker ps | grep -q redis; then
docker run -d -p 6379:6379 --name redis redis
fi
# Start Celery worker (in background)
celery -A social_media_manager worker --pool=solo &
# Start Celery beat (in background)
celery -A social_media_manager beat &
# Start Django server
python backend/manage.py runserver