feat: add one-click startup scripts for project management
- Add start.sh/start.bat for one-click startup (backend + frontend) - Add stop.sh/stop.bat for stopping all services - Add restart.sh for restarting services - Add status.sh for checking service status - Add Makefile with convenient management commands - Add comprehensive documentation (ONE_CLICK_START.md) - Update README with one-click startup instructions Features: - Automatic environment checking (venv, node_modules) - Process management with PID tracking - Unified log management (logs/*.log) - Health checking after startup - Support for Linux, macOS, and Windows - No more need for multiple terminal windows Usage: ./start.sh # Start all services ./stop.sh # Stop all services ./status.sh # Check service status ./restart.sh # Restart services make start # Alternative using Makefile Benefits: - One command instead of multiple terminals - Automatic environment validation - Centralized logging - Process lifecycle management - Developer-friendly output messages
This commit is contained in:
66
start.bat
Normal file
66
start.bat
Normal file
@@ -0,0 +1,66 @@
|
||||
@echo off
|
||||
REM ERP AI Assistant - Windows 启动脚本
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
echo ========================================
|
||||
echo ERP AI Assistant - 启动中...
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
REM 项目根目录
|
||||
set PROJECT_ROOT=%~dp0
|
||||
set BACKEND_DIR=%PROJECT_ROOT%backend
|
||||
set FRONTEND_DIR=%PROJECT_ROOT%frontend
|
||||
set LOGS_DIR=%PROJECT_ROOT%logs
|
||||
|
||||
REM 创建日志目录
|
||||
if not exist "%LOGS_DIR%" mkdir "%LOGS_DIR%"
|
||||
|
||||
REM 检查虚拟环境
|
||||
if not exist "%BACKEND_DIR%\venv" (
|
||||
echo [错误] 后端虚拟环境不存在
|
||||
echo 请先运行: cd backend ^&^& python -m venv venv ^&^& pip install -r requirements.txt
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM 检查 node_modules
|
||||
if not exist "%FRONTEND_DIR%\node_modules" (
|
||||
echo [错误] 前端依赖未安装
|
||||
echo 请先运行: cd frontend ^&^& npm install
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM 检查 .env 文件
|
||||
if not exist "%BACKEND_DIR%\.env" (
|
||||
echo [警告] .env 文件不存在,使用 .env.example
|
||||
copy "%BACKEND_DIR%\.env.example" "%BACKEND_DIR%\.env" > nul
|
||||
)
|
||||
|
||||
echo 启动后端服务...
|
||||
cd /d "%BACKEND_DIR%"
|
||||
start "ERP AI Assistant - Backend" cmd /c "venv\Scripts\activate && python -m app.main"
|
||||
echo 后端地址: http://localhost:8000
|
||||
echo API文档: http://localhost:8000/docs
|
||||
|
||||
echo.
|
||||
echo 启动前端服务...
|
||||
cd /d "%FRONTEND_DIR%"
|
||||
start "ERP AI Assistant - Frontend" cmd /c "npm run dev"
|
||||
echo 前端地址: http://localhost:5173
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo 启动完成!
|
||||
echo ========================================
|
||||
echo.
|
||||
echo 前端地址: http://localhost:5173
|
||||
echo 后端地址: http://localhost:8000
|
||||
echo API文档: http://localhost:8000/docs
|
||||
echo.
|
||||
echo 提示: 后端和前端已在新窗口中启动
|
||||
echo 关闭窗口即可停止服务
|
||||
echo.
|
||||
|
||||
cd /d "%PROJECT_ROOT%"
|
||||
pause
|
||||
Reference in New Issue
Block a user