-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·56 lines (44 loc) · 1.65 KB
/
start.sh
File metadata and controls
executable file
·56 lines (44 loc) · 1.65 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
echo "🚀 Starting CrisisCast..."
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is not installed. Please install Python 3.8+ and try again."
exit 1
fi
# Check Python version
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
REQUIRED_VERSION="3.8"
if [ "$(printf '%s\n' "$REQUIRED_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" != "$REQUIRED_VERSION" ]; then
echo "❌ Python $PYTHON_VERSION detected. Please install Python 3.8+ and try again."
exit 1
fi
echo "✅ Python $PYTHON_VERSION detected"
# Create virtual environment if it doesn't exist
if [ ! -d ".venv" ]; then
echo "📦 Creating virtual environment..."
python3 -m venv .venv
fi
# Activate virtual environment
echo "🔧 Activating virtual environment..."
source .venv/bin/activate
# Install dependencies
echo "📥 Installing dependencies..."
pip install -r requirements.txt
# Check if port 8000 is in use
if lsof -Pi :8000 -sTCP:LISTEN -t >/dev/null ; then
echo "⚠️ Port 8000 is already in use. Trying to kill the process..."
lsof -ti:8000 | xargs kill -9 2>/dev/null || true
sleep 2
fi
# Set environment variables for development
export DATABASE_URL="sqlite:///./crisiscast.db"
export REDIS_URL="redis://localhost:6379/0"
# Start the application
echo "🚀 Starting CrisisCast API..."
echo "=================================================="
echo "API Documentation: http://localhost:8000/docs"
echo "Health Check: http://localhost:8000/health"
echo "=================================================="
echo "Press Ctrl+C to stop the server"
echo ""
python run.py