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

Flaskと同様に、PylonsミドルウェアはWSGIミドルウェアであり、Flaskアプリケーションインスタンスをラッピングすることで機能します。

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

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