Files
diary-system/README.md
maoshen b273789ae8 Initial commit: 日记系统
完整的日记记录系统
- Django 后端 (diary app)
- 前端页面
- 部署脚本 (本地 + 云端)
- Nginx 配置
- 数据迁移和同步工具
2026-04-14 10:07:27 +00:00

68 lines
1.7 KiB
Markdown
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.
# 码神的日记系统
⚡ 记录每天的进步与成长
## 技术架构
- **后端**: Django + Django REST Framework
- **前端**: 原生 HTML/JS (轻量级)
- **数据库**: PostgreSQL (与城市手册共用)
- **部署**: Gunicorn + Nginx
## 快速启动
```bash
cd /root/.openclaw/workspace/diary-system
chmod +x start.sh
./start.sh
```
## 同步日记
```bash
python3 sync_diary.py
```
## 访问地址
### 本地部署
- **主页**: http://127.0.0.1:8001/
- **API**: http://127.0.0.1:8001/api/entries/
- **Admin**: http://127.0.0.1:8001/admin/
### 云服务器部署
- **主页**: http://cssc.datalibstar.com:8001/
- **API**: http://cssc.datalibstar.com:8001/api/entries/
- **Admin**: http://cssc.datalibstar.com:8001/admin/
⚠️ **注意**:如果无法访问云服务器,请在腾讯云控制台安全组中开放端口 `8001`
## API 接口
### 日记
- `GET /api/entries/` - 获取所有日记
- `GET /api/entries/today/` - 获取今天的日记
- `GET /api/entries/recent/` - 获取最近 7 天的日记
- `GET /api/entries/stats/` - 获取统计信息
- `POST /api/entries/` - 创建日记
- `PUT /api/entries/{id}/` - 更新日记
### 经验总结
- `GET /api/experiences/` - 获取所有经验
- `GET /api/experiences/recent/` - 获取最近 10 条经验
- `GET /api/experiences/by_category/` - 按类别分组
- `POST /api/experiences/` - 创建经验总结
- `PUT /api/experiences/{id}/` - 更新经验
## 数据库
使用现有的 PostgreSQL 数据库 (`cssc`),自动创建以下表:
- `diary_diaryentry` - 日记条目
- `diary_dailyprogress` - 每日进度
## 与城市手册的区别
- 端口不同(日记系统用 8001/8002城市手册用 80/8000
- 更轻量级的前端
- 专注于个人日记和进步追踪