本仓库是 fastapi-radar 的 Tortoise ORM 适配版
默认访问地址:http://localhost:8000/__radar
Install from GitHub repository:
pip install git+https://github.com/sleep1223/fastapi-radar.gitInstall with uv:
uv add git+https://github.com/sleep1223/fastapi-radar.gituv run pip install git+https://github.com/sleep1223/fastapi-radar.gitInstall from local source:
uv run pip install .Dev install:
uv run pip install -e ".[dev]"
## 使用
最小可用示例(集成 Tortoise ORM):
```python
from fastapi import FastAPI
from fastapi_radar import Radar
from tortoise.contrib.fastapi import register_tortoise
app = FastAPI()
radar = Radar(app)
register_tortoise(
app,
db_url="sqlite://example.db",
modules={"models": ["your_app.models", "fastapi_radar.models"]},
generate_schemas=True,
add_exception_handlers=True,
)
@app.get("/")
async def index():
return {"message": "ok"}启动应用后,访问:
- 安装开发依赖:
uv add pytest- 在项目根目录运行全部测试:
uv run pytest- 如果只想运行标记为集成测试的用例:
uv run pytest -m integration