ETest-Vue-FastAPI/start-all.bat

106 lines
2.5 KiB
Batchfile
Raw Permalink Normal View History

2026-03-30 10:38:36 +08:00
@echo off
chcp 65001 >nul
title ETest Full Stack Start
color 0A
echo ========================================
echo ETest Full Stack Start
echo ========================================
echo.
:: Check Python
echo [*] Checking Python...
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo [!] Python not found, please install Python 3.10+
pause
exit /b 1
)
echo [OK] Python ready
:: Check Node.js
echo [*] Checking Node.js...
node --version >nul 2>&1
if %errorlevel% neq 0 (
echo [!] Node.js not found, please install Node.js 16+
pause
exit /b 1
)
echo [OK] Node.js ready
echo.
echo ========================================
echo Step 1: Starting Backend
echo ========================================
echo.
:: Start Backend
cd /d C:\PPRO\ETest-Vue-FastAPI\ruoyi-fastapi-backend
:: Activate venv
if exist venv\Scripts\activate.bat (
call venv\Scripts\activate.bat
) else (
echo [*] Creating virtual environment...
python -m venv venv
call venv\Scripts\activate.bat
pip install -r requirements.txt
)
echo [*] Starting backend server...
echo [*] Database: 123.57.81.127:3306
echo [*] API: http://localhost:9099
echo.
:: Start backend in new window
start "ETest Backend" cmd /k "cd /d C:\PPRO\ETest-Vue-FastAPI\ruoyi-fastapi-backend && venv\Scripts\activate && python server.py"
:: Wait for backend to start
echo [*] Waiting for backend to start (10 seconds)...
timeout /t 10 /nobreak >nul
:: Check if backend is running
curl -s http://localhost:9099/docs >nul 2>&1
if %errorlevel% neq 0 (
echo [*] Backend may still be starting, waiting another 10 seconds...
timeout /t 10 /nobreak >nul
)
echo [OK] Backend started
echo.
echo ========================================
echo Step 2: Starting Frontend
echo ========================================
echo.
:: Start Frontend
cd /d C:\PPRO\ETest-Vue-FastAPI\ruoyi-fastapi-frontend
:: Check node_modules
if not exist node_modules (
echo [*] Installing frontend dependencies...
npm install
)
echo [*] Starting frontend server...
echo [*] URL: http://localhost:80
echo.
:: Start frontend in new window
start "ETest Frontend" cmd /k "cd /d C:\PPRO\ETest-Vue-FastAPI\ruoyi-fastapi-frontend && npm run dev"
echo [OK] Frontend started
echo.
echo ========================================
echo All Services Started!
echo ========================================
echo.
echo Backend: http://localhost:9099
echo Frontend: http://localhost:80
echo API Docs: http://localhost:9099/docs
echo.
echo Press any key to exit this window (services will keep running)
pause >nul