/starlette-werkzeug-debugger

Werkzeug debugger middleware for Starlette

Primary LanguagePythonMIT LicenseMIT

Werkzeug debugger middleware for Starlette

codecov version downloads license

This package contains interactive debuger middleware for Starlette / FastAPI.

Install

pip install starlette_werkzeug_debugger

Usage with Starlette

from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette.routing import Route
import starlette_werkzeug_debugger


async def raise_error(request):
        local_var = 3
        raise RuntimeError("Raised error")


middleware = [
        Middleware(starlette_werkzeug_debugger.WerkzeugDebugMiddleware, evalex=True)
]


app = Starlette(debug=True, middleware=middleware, routes=[
        Route('/', raise_error),
])

Usage with FastAPI

from fastapi import FastAPI
import starlette_werkzeug_debugger


app = FastAPI()


app.add_middleware(starlette_werkzeug_debugger.WerkzeugDebugMiddleware, evalex=True)


@app.get("/")
async def raise_error():
        local_var = 3
        raise RuntimeError("Raised error")

Screenshots

https://raw.github.com/wiki/mireq/starlette-werkzeug-debugger/debugger.png?v=2023-06-20