更新
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# 启动后端 API(兼容 install.sh .venv / 宝塔 Python 项目)
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$ROOT/backend"
|
||||
|
||||
export PLAYWRIGHT_BROWSERS_PATH="${PLAYWRIGHT_BROWSERS_PATH:-$ROOT/playwright-browsers}"
|
||||
|
||||
PY=""
|
||||
if [ -x ".venv/bin/python" ]; then
|
||||
PY=".venv/bin/python"
|
||||
elif command -v python &>/dev/null; then
|
||||
PY="$(command -v python)"
|
||||
fi
|
||||
|
||||
if [ -z "$PY" ]; then
|
||||
echo "[错误] 未找到 Python,请运行 ./install.sh 或配置宝塔 Python 项目"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HOST="${KEFU_HOST:-0.0.0.0}"
|
||||
PORT="${KEFU_PORT:-8000}"
|
||||
|
||||
echo "[System] Starting FastAPI backend..."
|
||||
echo "[System] Python: $PY"
|
||||
echo "[System] URL: http://${HOST}:${PORT}"
|
||||
echo
|
||||
|
||||
exec "$PY" -m uvicorn main:app --host "$HOST" --port "$PORT"
|
||||
Reference in New Issue
Block a user