docs: Add port configuration guide

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
empty
2026-01-10 16:13:23 +08:00
parent 3f59b324ad
commit 3a8ec576ee

View File

@@ -0,0 +1,54 @@
# 端口配置说明
## 默认端口
| 服务 | 默认端口 | 说明 |
|------|---------|------|
| FastAPI 后端 | 8000 | API 服务和文档 |
| Next.js 编辑器 | 3000 | 时间轴编辑器 |
| Streamlit Web UI | 8501 | Web 界面 |
## 自定义端口
### 方式 1: 环境变量(临时)
```bash
# 自定义所有端口
API_PORT=8080 EDITOR_PORT=3001 WEB_PORT=8502 ./dev.sh
# 只自定义部分端口
API_PORT=8080 ./dev.sh
```
### 方式 2: .env 文件(持久)
1. 复制示例配置文件:
```bash
cp .env.example .env
```
2. 编辑 `.env` 文件,修改端口:
```bash
API_PORT=8080
EDITOR_PORT=3001
WEB_PORT=8502
```
3. 启动服务:
```bash
./dev.sh
```
## 注意事项
1. **端口冲突**:确保选择的端口没有被其他程序占用
2. **防火墙**:如需外部访问,请配置防火墙规则
3. **前端重建**修改端口后Next.js 前端会自动重建(首次启动较慢)
## 验证端口配置
启动后访问以下地址确认服务正常:
- API 文档: `http://localhost:{API_PORT}/docs`
- 编辑器: `http://localhost:{EDITOR_PORT}`
- Web UI: `http://localhost:{WEB_PORT}`