Files
weibo_signin/CHECKLIST.md
2026-03-09 16:10:29 +08:00

160 lines
4.3 KiB
Markdown
Raw Permalink 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.
# 本地启动前检查清单
## ✅ 配置检查
### 1. 数据库配置
- [x] SQLite 作为默认数据库
- [x] `backend/shared/config.py` 默认值设置为 SQLite
- [x] `backend/.env.local` 配置正确
- [x] 添加 `aiosqlite` 到 requirements.txt
### 2. Redis 配置
- [x] Redis 设置为可选(`USE_REDIS=false`
- [x] `auth_service` 支持内存存储(不依赖 Redis
- [x] `task_scheduler` 支持内存锁(不依赖 Redis
- [x] 启动脚本移除 Redis 检查
### 3. 端口配置
- [x] Auth Service: 8001
- [x] API Service: 8000
- [x] Frontend: 5000
- [x] 所有服务端口配置一致
### 4. 环境变量
- [x] `backend/.env.local` 创建完成
- [x] `frontend/.env` 创建完成
- [x] JWT 密钥配置
- [x] Cookie 加密密钥配置
## ✅ 文件检查
### 必需文件
- [x] `create_sqlite_db.py` - 数据库初始化脚本
- [x] `init-db-sqlite.sql` - SQLite 建表脚本
- [x] `start_all.bat` - Windows 启动脚本
- [x] `stop_all.bat` - Windows 停止脚本
- [x] `backend/.env.local` - 后端环境配置
- [x] `frontend/.env` - 前端环境配置
- [x] `LOCAL_SETUP.md` - 本地配置文档
- [x] `CHECKLIST.md` - 本检查清单
### 依赖文件
- [x] `backend/requirements.txt` - 包含 aiosqlite
- [x] `frontend/requirements.txt` - Flask 依赖
## ✅ 代码修改
### backend/shared/config.py
- [x] 默认数据库改为 SQLite
- [x] Redis 设置为可选
- [x] 添加 `USE_REDIS` 配置项
### backend/auth_service/app/utils/security.py
- [x] Refresh Token 支持内存存储
- [x] Redis 连接失败时降级到内存
- [x] 添加过期 token 清理逻辑
### backend/task_scheduler/app/tasks/signin_tasks.py
- [x] 分布式锁支持内存模式
- [x] Redis 不可用时使用内存锁
### backend/requirements.txt
- [x] 添加 `aiosqlite==0.19.0`
## ✅ 启动流程
### 自动启动(推荐)
```bash
start_all.bat
```
### 手动启动步骤
1. [x] 创建数据库: `python create_sqlite_db.py`
2. [x] 安装后端依赖: `cd backend && pip install -r requirements.txt`
3. [x] 安装前端依赖: `cd frontend && pip install -r requirements.txt`
4. [x] 启动 Auth Service (端口 8001)
5. [x] 启动 API Service (端口 8000)
6. [x] 启动 Frontend (端口 5000)
## ✅ 功能验证
### 测试账号
```
用户名: admin
邮箱: admin@example.com
密码: Admin123!
```
### 基础功能
- [ ] 访问前端页面 http://localhost:5000
- [ ] 使用测试账号登录
- [ ] Token 刷新功能
- [ ] 添加微博账号
- [ ] 查看账号列表
- [ ] 编辑账号信息
- [ ] 删除账号
- [ ] 创建签到任务
- [ ] 查看签到日志
- [ ] 用户注册功能(创建新用户)
### API 文档
- [ ] Auth Service API 文档: http://localhost:8001/docs
- [ ] API Service API 文档: http://localhost:8000/docs
## ⚠️ 已知限制
### 本地开发模式
- ✅ 不需要 Redis使用内存存储
- ✅ 不需要 MySQL使用 SQLite
- ⚠️ Task Scheduler 和 Signin Executor 需要 Celery本地测试可跳过
- ⚠️ 内存存储在服务重启后会丢失 Refresh Token
### 生产环境要求
- ❌ 必须使用 Redis分布式环境
- ❌ 建议使用 MySQL性能和并发
- ❌ 必须配置 Celery任务调度
- ❌ 必须修改所有默认密钥
## 🔧 故障排查
### 问题:找不到模块
**解决方案**: 设置 PYTHONPATH
```bash
set PYTHONPATH=%CD%
```
### 问题:端口被占用
**解决方案**:
1. 检查端口占用: `netstat -ano | findstr :8000`
2. 关闭占用进程或修改端口配置
### 问题:数据库文件损坏
**解决方案**:
1. 删除 `weibo_hotsign.db`
2. 重新运行 `python create_sqlite_db.py`
### 问题Redis 警告
**解决方案**:
- 本地开发可以忽略,系统会自动使用内存存储
- 如需完整功能,安装并启动 Redis
## 📝 开发注意事项
1. **虚拟环境**: 每个服务使用独立的虚拟环境
2. **热重载**: 开发模式下代码修改会自动重启
3. **日志查看**: 每个服务有独立的命令行窗口显示日志
4. **数据持久化**: SQLite 数据库文件在项目根目录
5. **Session 存储**: Flask Session 使用文件系统存储
## ✨ 下一步
- [ ] 测试所有功能
- [ ] 添加测试数据
- [ ] 配置 Celery如需任务调度
- [ ] 部署到生产环境
---
**最后更新**: 2024
**维护者**: Weibo-HotSign Team