70 lines
977 B
Markdown
70 lines
977 B
Markdown
# quantum-stack-interview
|
||
|
||
|
||
## 环境要求
|
||
- Python >= 3.9
|
||
- Docker(用于 Redis)
|
||
|
||
## 安装依赖
|
||
|
||
推荐使用 [uv](https://github.com/astral-sh/uv) 进行依赖管理:
|
||
|
||
```bash
|
||
uv sync
|
||
```
|
||
|
||
或使用 pip:
|
||
|
||
```bash
|
||
pip install -e .
|
||
```
|
||
|
||
## 启动 Redis
|
||
|
||
项目依赖 Redis,推荐使用 Docker 启动:
|
||
|
||
```bash
|
||
just start_redis
|
||
```
|
||
|
||
或手动执行:
|
||
|
||
```bash
|
||
docker compose -f docker/docker-compose.dev.yaml up -d redis
|
||
```
|
||
|
||
Redis 默认监听 6379 端口。
|
||
|
||
## 启动项目
|
||
|
||
开发环境下可使用 uvicorn 启动 ASGI 服务:
|
||
|
||
```bash
|
||
just run
|
||
```
|
||
|
||
或手动执行:
|
||
|
||
```bash
|
||
uvicorn quantum_stack_interview.asgi:application --reload
|
||
```
|
||
|
||
访问地址: http://127.0.0.1:8000/
|
||
|
||
## 运行测试
|
||
|
||
```bash
|
||
pytest
|
||
```
|
||
|
||
## 主要功能
|
||
- 商品搜索、创建
|
||
- 批量下单
|
||
- Redis 缓存加速搜索
|
||
|
||
## 目录结构
|
||
- `shop/` 业务代码(商品、订单等)
|
||
- `quantum_stack_interview/` 项目配置
|
||
- `docker/` Docker 配置
|
||
- `tests/` 测试用例
|