Pythonエージェント用のContrast WSGIミドルウェアの設定

WSGIミドルウェアはアプリケーションインスタンスをラッピングするクラスとして実装されます(これは、FlaskおよびPylonsの両方のミドルウェアの基盤にもなります)。

# This line imports the Contrast middleware class from the package
from contrast.agent.middlewares.wsgi_middleware import WSGIMiddleware as ContrastMiddleware

# other app code

app = get_wsgi_application()

# This line wraps the application instance with the Contrast middleware
app = ContrastMiddleware(app)

WSGIミドルウェアの詳細については、WSGIの仕様を参照してください。