feat(scripts): dev.sh 前后端一键 start/stop/restart/status/logs
- 启动后端 uvicorn(:8000, --reload, 0.0.0.0) + 前端 next dev(:3000),setsid 独立进程组 - 停止按 pidfile + 监听端口双定位,整进程组清理(无子进程残留,实测残留 0) - 端口探测 ss 优先(lsof 在该环境对 socket 不可靠) - status/logs/restart;支持 API_PORT/WEB_PORT/BACKEND_API_URL 覆盖 - 日志落 logs/,pid 落 .run/(均已 gitignore);USAGE §5 增加用法
This commit is contained in:
@@ -126,6 +126,21 @@ uv run python -m app.cli.sync export [--years 2023,2024] # 日线
|
||||
|
||||
## 5. 启动
|
||||
|
||||
**一键脚本(后端 + 前端同时管理)**:
|
||||
|
||||
```bash
|
||||
scripts/dev.sh start # 启动后端(8000) + 前端(3000)
|
||||
scripts/dev.sh status # 查看状态
|
||||
scripts/dev.sh restart # 重启
|
||||
scripts/dev.sh stop # 停止
|
||||
scripts/dev.sh logs api # 跟踪后端日志(web 同理)
|
||||
|
||||
# 局域网访问前端时(例如 http://192.168.1.160:3000):
|
||||
# BACKEND_API_URL=http://192.168.1.160:8000 scripts/dev.sh start
|
||||
```
|
||||
|
||||
手动分别启动见下:
|
||||
|
||||
```bash
|
||||
# 后端(端口 8000)
|
||||
cd backend
|
||||
|
||||
Reference in New Issue
Block a user