2025-12-29 03:06:49 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2026-04-08 07:27:26 +07:00
|
|
|
# QuantDinger Python API startup script
|
2025-12-29 03:06:49 +08:00
|
|
|
|
2026-04-08 07:27:26 +07:00
|
|
|
# Activate the virtual environment if one is used
|
2025-12-29 03:06:49 +08:00
|
|
|
# source venv/bin/activate
|
|
|
|
|
|
2026-04-08 07:27:26 +07:00
|
|
|
# Check whether dependencies are installed
|
2025-12-29 03:06:49 +08:00
|
|
|
if ! python -c "import flask" 2>/dev/null; then
|
2026-04-08 07:27:26 +07:00
|
|
|
echo "Installing dependencies..."
|
2025-12-29 03:06:49 +08:00
|
|
|
pip install -r requirements.txt
|
|
|
|
|
fi
|
|
|
|
|
|
2026-04-08 07:27:26 +07:00
|
|
|
# Start the service
|
|
|
|
|
echo "Starting QuantDinger Python API service..."
|
|
|
|
|
echo "Service address: http://0.0.0.0:5000"
|
2025-12-29 03:06:49 +08:00
|
|
|
|
2026-04-08 07:27:26 +07:00
|
|
|
# Create the log directory
|
2025-12-29 03:06:49 +08:00
|
|
|
mkdir -p logs
|
|
|
|
|
|
2026-04-08 07:27:26 +07:00
|
|
|
# Development environment (uses the new entry file)
|
2025-12-29 03:06:49 +08:00
|
|
|
python run.py
|
|
|
|
|
|
2026-04-08 07:27:26 +07:00
|
|
|
# Production environment (uses gunicorn)
|
2025-12-29 03:06:49 +08:00
|
|
|
# gunicorn -w 4 -b 0.0.0.0:5000 --timeout 120 --access-logfile logs/access.log --error-logfile logs/error.log "run:create_app()"
|