-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathserver-python
More file actions
executable file
·43 lines (34 loc) · 1.14 KB
/
server-python
File metadata and controls
executable file
·43 lines (34 loc) · 1.14 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
#!/bin/bash
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "Python 3 is not installed. Please install Python 3 and try again."
exit 1
fi
# Check if pip is installed
if ! command -v pip3 &> /dev/null; then
echo "pip3 is not installed. Please install pip3 and try again."
exit 1
fi
# Check if virtual environment exists, if not create it
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
source venv/bin/activate
# Install dependencies if requirements.txt exists
if [ -f "requirements.txt" ]; then
echo "Installing dependencies..."
pip install -r requirements.txt
fi
# Run the Python server with hot reloading enabled
echo "Starting Python server with hot reloading..."
# Flask specific environment variables
export FLASK_APP=server/main.py
export FLASK_ENV=development
export FLASK_DEBUG=1
# Make sure watchdog is installed for better hot reload performance
pip install watchdog > /dev/null 2>&1
# Run the server with the Python from the virtual environment
# Use python3 explicitly to ensure compatibility
python3 server/main.py