Files
zcglxt/backend_new/start.bat

64 lines
1.5 KiB
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 资产管理系统后端启动脚本 (Windows)
echo ====================================
echo 资产管理系统后端服务
echo ====================================
echo.
REM 检查Python环境
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo [错误] 未找到Python环境请先安装Python 3.10+
pause
exit /b 1
)
REM 检查虚拟环境
if not exist "venv\" (
echo [信息] 虚拟环境不存在,正在创建...
python -m venv venv
echo [成功] 虚拟环境创建完成
)
REM 激活虚拟环境
echo [信息] 激活虚拟环境...
call venv\Scripts\activate.bat
REM 检查依赖
echo [信息] 检查依赖...
pip show fastapi >nul 2>&1
if %errorlevel% neq 0 (
echo [信息] 正在安装依赖...
pip install -r requirements.txt
)
REM 检查环境变量文件
if not exist ".env" (
echo [警告] .env文件不存在正在从示例创建...
copy .env.example .env
echo [警告] 请编辑.env文件配置数据库连接等信息
pause
)
REM 创建必要的目录
if not exist "logs\" mkdir logs
if not exist "uploads\qrcodes\" mkdir uploads\qrcodes
if not exist "uploads\avatars\" mkdir uploads\avatars
if not exist "uploads\documents\" mkdir uploads\documents
echo.
echo ====================================
echo 启动开发服务器...
echo ====================================
echo.
echo API文档地址: http://localhost:8000/docs
echo ReDoc文档地址: http://localhost:8000/redoc
echo 按 Ctrl+C 停止服务
echo.
REM 启动服务
python run.py
pause