baoxiang/QUICKSTART.md
2025-12-16 18:06:50 +08:00

131 lines
2.0 KiB
Markdown
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.

# 🚀 快速启动指南
## 一键启动(推荐)
使用 Docker Compose 一键启动所有服务:
```bash
# 启动所有服务MySQL、Redis、后端、前端
docker-compose up -d
# 查看服务状态
docker-compose ps
# 查看日志
docker-compose logs -f backend
```
启动后访问:
- **前端界面**: http://localhost:3000
- **后端 API**: http://localhost:8000
- **API 文档**: http://localhost:8000/docs
---
## 分别启动
### 1. 后端服务
```bash
# 进入后端目录
cd backend
# 安装依赖
pip install -r requirements.txt
# 启动服务
python run.py
```
### 2. 前端服务
```bash
# 进入前端目录
cd frontend
# 安装依赖
npm install
# 启动开发服务器
npm run dev
```
---
## 📋 系统要求
- **Docker**: 20.10+
- **Docker Compose**: 2.0+
- **Python**: 3.10+
- **Node.js**: 16+
---
## 🔧 配置说明
### 环境变量
复制环境变量示例文件:
```bash
cp .env.example .env
```
主要配置项:
- `DATABASE_URL`: MySQL 连接地址
- `SECRET_KEY`: JWT 密钥
- `REDIS_HOST`: Redis 主机地址
### MySQL 连接信息
通过 Docker 启动时:
```
主机: localhost
端口: 3306
数据库: treasure_box_game
用户名: root
密码: treasure_box_2024
```
---
## 🐛 常见问题
### Q: Docker 启动失败?
A: 检查端口占用情况:
```bash
# Windows
netstat -ano | findstr :3306
# Linux/Mac
lsof -i :3306
```
### Q: 数据库连接失败?
A: 确保 MySQL 容器已启动并健康:
```bash
docker-compose ps
docker-compose logs mysql
```
### Q: 前端无法连接后端?
A: 检查 Vite 代理配置和后端 CORS 设置
---
## 📚 更多文档
- **完整迁移指南**: `MYSQL_迁移指南.md`
- **项目完成报告**: `项目完成报告.md`
- **前端开发文档**: `frontend/README.md`
- **后端 API 文档**: http://localhost:8000/docs
---
## 🎯 下一步
1. 访问 http://localhost:3000 注册用户
2. 体验完整的竞猜流程
3. 尝试创建宝箱(需要 streamer 权限)
4. 查看 API 文档了解所有接口
**祝您使用愉快!** 🎉