Files
ai_mip/start_production.bat
2026-01-13 18:59:26 +08:00

58 lines
1.3 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
chcp 65001 >nul
echo ========================================
echo MIP广告点击服务 - 生产环境启动
echo ========================================
echo.
REM 设置生产环境
set ENV=production
REM 检查Python是否安装
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo 错误: 未检测到Python请先安装Python 3.8+
pause
exit /b 1
)
REM 检查是否存在虚拟环境
if not exist "venv" (
echo 未检测到虚拟环境,正在创建...
python -m venv venv
echo 虚拟环境创建完成
echo.
)
REM 激活虚拟环境
echo 激活虚拟环境...
call venv\Scripts\activate.bat
REM 检查是否已安装依赖
pip show flask >nul 2>&1
if %errorlevel% neq 0 (
echo 正在安装依赖包...
pip install -r requirements.txt
echo 依赖安装完成
echo.
echo 正在安装 Playwright 浏览器...
python -m playwright install chromium
echo Playwright 浏览器安装完成
echo.
)
REM 检查生产环境配置文件
if not exist ".env.production" (
echo 错误: 未检测到生产环境配置文件 .env.production
echo 请先配置生产环境参数
pause
exit /b 1
)
REM 启动服务
echo 正在启动MIP广告点击服务生产环境...
echo.
python app.py
pause