Skip to content

mongkok/fastapi-debug-toolbar

Repository files navigation

FastAPI Debug Toolbar

FastAPI Debug Toolbar

🐞A debug toolbar for FastAPI based on the original django-debug-toolbar.🐞
Swagger UI & GraphQL are supported.

Test Coverage Codacy Package version


Documentation: https://fastapi-debug-toolbar.domake.io


Installation

pip install fastapi-debug-toolbar

Quickstart

Add DebugToolbarMiddleware middleware to your FastAPI application:

from debug_toolbar.middleware import DebugToolbarMiddleware
from fastapi import FastAPI

app = FastAPI(debug=True)
app.add_middleware(DebugToolbarMiddleware)

SQLAlchemy

Please make sure to use the "Dependency Injection" system as described in the FastAPI docs and add the SQLAlchemyPanel to your panel list:

app.add_middleware(
    DebugToolbarMiddleware,
    panels=["debug_toolbar.panels.sqlalchemy.SQLAlchemyPanel"],
)

Tortoise ORM

Add the TortoisePanel to your panel list:

app.add_middleware(
    DebugToolbarMiddleware,
    panels=["debug_toolbar.panels.tortoise.TortoisePanel"],
)