Files
ocean/backend
2026-01-31 11:02:59 +08:00
..
2026-01-31 11:02:59 +08:00
2026-01-31 11:02:59 +08:00
2026-01-31 00:01:19 +08:00
2026-01-31 11:02:59 +08:00
2026-01-31 11:02:59 +08:00
2026-01-31 11:02:59 +08:00
2026-01-31 11:02:59 +08:00
2026-01-31 11:02:59 +08:00
2026-01-31 11:02:59 +08:00
2026-01-31 11:02:59 +08:00
2026-01-31 11:02:59 +08:00

项目管理系统后端

依据《产品文档》与《API 文档》,Python + FastAPI 实现,TDD 开发。

目录结构

backend/
├── src/           # 后端源码
│   ├── __init__.py
│   └── app.py     # FastAPI 应用与路由
├── tests/         # 测试用例
├── pytest.ini     # pytest 配置(pythonpath = src
├── requirements.txt
└── API.md

运行测试

cd backend
source .venv/bin/activate
pytest tests/ -v

pytest 会通过 pytest.inipythonpath = src 自动把 src 加入 Python 路径,无需手动设置 PYTHONPATH。

启动服务

cd backend
source .venv/bin/activate
PYTHONPATH=src uvicorn app:app --reload --host 0.0.0.0 --port 8000

或进入 src 再启动:

cd backend/src
uvicorn app:app --reload --host 0.0.0.0 --port 8000