huibao/start.bat

51 lines
1.9 KiB
Batchfile
Raw Permalink 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
chcp 65001 >nul
title 情报系统 - 一键启动
echo.
echo ╔══════════════════════════════════════════╗
echo ║ 情报系统 - 一键启动 ║
echo ╚══════════════════════════════════════════╝
echo.
:: 检查Python环境
where python >nul 2>&1
if %errorlevel% neq 0 (
echo [错误] 未找到 Python请先安装 Python
pause
exit /b 1
)
:: 启动后端服务
echo [1/2] 正在启动后端服务 (FastAPI)...
start "后端服务 - FastAPI" cmd /k "cd /d %~dp0backend && python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"
:: 等待后端启动
timeout /t 3 /nobreak >nul
:: 启动前端服务
echo [2/2] 正在启动前端服务 (HTTP Server)...
start "前端服务 - HTTP" cmd /k "cd /d %~dp0frontend && python -m http.server 5500"
:: 等待前端启动
timeout /t 2 /nobreak >nul
echo.
echo ╔══════════════════════════════════════════╗
echo ║ 启动完成! ║
echo ╠══════════════════════════════════════════╣
echo ║ 后端地址: http://localhost:8000 ║
echo ║ 前端地址: http://localhost:5500 ║
echo ║ API文档: http://localhost:8000/docs ║
echo ╠══════════════════════════════════════════╣
echo ║ 按任意键打开浏览器... ║
echo ╚══════════════════════════════════════════╝
echo.
pause >nul
:: 打开浏览器
start http://localhost:5500
exit