Files
wecom_it_smart_desk/scripts/start_backend.bat
T

31 lines
913 B
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
REM =====================================================================
REM 启动后端服务(支持从任意位置运行)
REM 用法:scripts\start_backend.bat
REM =====================================================================
REM 获取脚本所在目录,然后计算项目根目录(scripts 的上级目录)
set SCRIPT_DIR=%~dp0
set PROJECT_ROOT=%SCRIPT_DIR%..
REM 切换到 backend 目录
cd /d "%PROJECT_ROOT%\backend"
if errorlevel 1 (
echo [ERROR] 找不到 backend 目录:%PROJECT_ROOT%\backend
pause
exit /b 1
)
REM 优先使用 venv 中的 python,找不到则使用 PATH 中的 python
if exist "venv\Scripts\python.exe" (
set PYTHON_EXE=venv\Scripts\python.exe
) else (
set PYTHON_EXE=python
)
echo [INFO] 工作目录:%CD%
echo [INFO] Python%PYTHON_EXE%
echo.
"%PYTHON_EXE%" -X utf8 -m uvicorn app.main:app --host 127.0.0.1 --port 8000