feat: 投资资讯日报查询页 + 文档更新 + 拉取服务器最新内容
- 新增 charts/news_reports.php 报告查询导航页(列表+详情一体,fetch API 渲染) - 新增 js/newsReports.js:AI 摘要/新闻联播/财经新闻/公告调研/数据总览固定模块,stats 归一化兼容多种格式 - index-2.php 研究报告卡片改为导航链接,移除 PHP 目录下拉框 - 更新 AGENTS.md/CLAUDE.md(路径、页面清单、数据模式等核实修正) - 同步服务器拉取的文档:quant 使用手册、podcast-docs - 生成 continuation.md 会话检查点
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
# 部署文档
|
||||
|
||||
> 当前部署环境: doorcome.cn (Debian 12)
|
||||
|
||||
## 服务器要求
|
||||
|
||||
| 组件 | 版本 | 用途 |
|
||||
|------|------|------|
|
||||
| Python | 3.11+ | Django + Celery |
|
||||
| MySQL/MariaDB | 10.11+ | 数据存储 |
|
||||
| Redis | 6+ | Celery Broker |
|
||||
| Nginx | — | 反向代理 |
|
||||
| Node.js | 18+ | 前端 |
|
||||
|
||||
## 目录结构
|
||||
|
||||
```
|
||||
/home/simon/myquant/django/podcast/ # 后端代码
|
||||
├── venv/ # Python 虚拟环境
|
||||
├── staticfiles/ # Django 静态文件
|
||||
├── data/audios/ # 音频文件
|
||||
├── logs/ # 日志
|
||||
└── frontend/ # 前端代码
|
||||
└── .next/ # 前端构建产物
|
||||
```
|
||||
|
||||
## systemd 服务
|
||||
|
||||
| 服务 | 端口 | 说明 |
|
||||
|------|------|------|
|
||||
| `podcast-gunicorn` | 8001 | Django API |
|
||||
| `podcast-celery` | — | AI 处理 Worker |
|
||||
| `podcast-frontend` | 3000 | Next.js 前端 |
|
||||
|
||||
### 管理命令
|
||||
|
||||
```bash
|
||||
sudo systemctl status podcast-gunicorn
|
||||
sudo systemctl restart podcast-celery
|
||||
sudo journalctl -u podcast-frontend -n 50 -f
|
||||
```
|
||||
|
||||
## Nginx 路由
|
||||
|
||||
| 路径 | 后端 |
|
||||
|------|------|
|
||||
| `/api/` | `127.0.0.1:8001` (Django) |
|
||||
| `/admin/` | `127.0.0.1:8001` (Django) |
|
||||
| `/static/` | Django 静态文件 |
|
||||
| `/media/` | 音频文件 |
|
||||
| `/podcast/` | `127.0.0.1:3000` (Next.js) |
|
||||
|
||||
## 首次部署
|
||||
|
||||
```bash
|
||||
# 1. 同步代码
|
||||
rsync -avz --delete --exclude='node_modules' --exclude='__pycache__' \
|
||||
--exclude='.env' --exclude='venv' --exclude='.next' \
|
||||
./ doorcome:/home/simon/myquant/django/podcast/
|
||||
|
||||
# 2. 安装依赖
|
||||
ssh doorcome
|
||||
cd /home/simon/myquant/django/podcast
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
# 3. 配置环境变量
|
||||
vi .env # 填入数据库连接、API Key 等
|
||||
|
||||
# 4. 数据库迁移
|
||||
python manage.py migrate
|
||||
python manage.py collectstatic --noinput
|
||||
python manage.py createsuperuser
|
||||
|
||||
# 5. 启动服务
|
||||
sudo systemctl start podcast-gunicorn
|
||||
sudo systemctl start podcast-celery
|
||||
sudo systemctl start podcast-frontend
|
||||
|
||||
# 6. 配置 Nginx
|
||||
# 编辑 /etc/nginx/sites-enabled/default 添加反向代理配置
|
||||
sudo nginx -t && sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
## 更新部署
|
||||
|
||||
```bash
|
||||
# 本地同步代码
|
||||
rsync -avz --delete --exclude={node_modules,__pycache__,.env,venv,.next,db.sqlite3} \
|
||||
./ doorcome:/home/simon/myquant/django/podcast/
|
||||
|
||||
# 远程执行
|
||||
ssh doorcome "
|
||||
cd /home/simon/myquant/django/podcast
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt -q
|
||||
python manage.py migrate
|
||||
python manage.py collectstatic --noinput
|
||||
sudo systemctl restart podcast-gunicorn podcast-celery
|
||||
|
||||
cd frontend
|
||||
npm install -q
|
||||
npm run build
|
||||
sudo systemctl restart podcast-frontend
|
||||
"
|
||||
```
|
||||
|
||||
## 配置项
|
||||
|
||||
参见 `/home/simon/myquant/django/podcast/.env`:
|
||||
|
||||
| 配置项 | 说明 |
|
||||
|--------|------|
|
||||
| `DEBUG` | 生产环境设为 False |
|
||||
| `ALLOWED_HOSTS` | 允许的域名 |
|
||||
| `DB_*` | MySQL 连接信息 |
|
||||
| `REDIS_URL` | Redis 连接 |
|
||||
| `DASHSCOPE_API_KEY` | 千问 ASR API Key |
|
||||
| `DEEPSEEK_API_KEY` | DeepSeek API Key |
|
||||
| `DEV_MOCK_ASR` | 0=真实 ASR, 1=Mock(开发用) |
|
||||
Reference in New Issue
Block a user