Files
shaguabijia-app-server/run.sh
T
lowmaster-chen e1bd0e3ef7 feat: 接入数据大盘聚合与美团 CPS 对账
改了什么:新增新版大盘日期窗口聚合、广告收益拆分、比价耗时字段、美团 CPS 拉单入库与大盘展示,并同步反馈审核和邀请奖励下线口径。
验证:python -m pytest tests/test_admin_read.py tests/test_admin_write.py tests/test_compare_record.py tests/test_invite.py tests/test_feedback.py -q。
2026-06-28 09:56:13 +08:00

28 lines
1.2 KiB
Bash
Executable File
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.
#!/usr/bin/env bash
# 本地开发启动脚本:监听 0.0.0.0(真机局域网 / adb reverse 都能连),改代码自动重启。
#
# 前置(首次):先激活装好依赖的环境,例如:
# conda activate price && pip install -e .
# 真机联调流程见前台 local.properties 的 debug.api.host。
set -e
cd "$(dirname "$0")"
if [ ! -f .env ]; then
echo "❌ 缺 .env:先 cp .env.example .env 并填值(至少 JWT_SECRET_KEY;测美团再填 MT_CPS_*"
exit 1
fi
mkdir -p data # sqlite 文件所在目录
alembic upgrade head # 确保表已建(幂等,已是最新则 no-op)
# 默认不开 --reload:Windows 下 --reload 会同时跑 reloader 主进程 + worker 两个进程,
# 二者都持有 logs/app-server.log 的 RotatingFileHandler,轮转(rename)时文件被占用 →
# WinError 32 刷屏(Linux 的 rename 宽松不会炸,故仅 Windows 受影响);且 watchfiles 监控
# logs 目录会自我放大。需要热重载(建议仅 Linux/Mac)用:RELOAD=1 ./run.sh
if [ "${RELOAD:-0}" = "1" ]; then
# 只监控 app 目录,避免再监控 logs/ 触发上述放大
exec uvicorn app.main:app --host 0.0.0.0 --port 8770 --reload --reload-dir app
else
exec uvicorn app.main:app --host 0.0.0.0 --port 8770
fi