# 项目管理系统后端 依据《产品文档》与《API 文档》,Python + FastAPI 实现,TDD 开发。 ## 目录结构 ``` backend/ ├── src/ # 后端源码 │ ├── __init__.py │ └── app.py # FastAPI 应用与路由 ├── tests/ # 测试用例 ├── pytest.ini # pytest 配置(pythonpath = src) ├── requirements.txt └── API.md ``` ## 运行测试 ```bash cd backend source .venv/bin/activate pytest tests/ -v ``` pytest 会通过 `pytest.ini` 的 `pythonpath = src` 自动把 `src` 加入 Python 路径,无需手动设置 PYTHONPATH。 ## 启动服务 ```bash cd backend source .venv/bin/activate PYTHONPATH=src uvicorn app:app --reload --host 0.0.0.0 --port 8000 ``` 或进入 `src` 再启动: ```bash cd backend/src uvicorn app:app --reload --host 0.0.0.0 --port 8000 ```