Installing Airbrake in a Flask app

python flag


Step 1: Install the latest version of pybrake

Airbrake for Flask uses our official Python notifier pybrake. To install run:

pip install -U pybrake

Step 2: Configure the Airbrake Flask middleware

Replace the placeholder project_id and project_key values from the example below with the real values from your project’s setting page.

Note: Flask integration uses Flask signals and therefore requires the blinker library.

from flask import Flask
import pybrake.flask

app = Flask(__name__)

app.config['PYBRAKE'] = dict(
app = pybrake.flask.init_app(app)

Sending errors to Airbrake

    raise ValueError('hello')
except Exception as err:

For more information, check out pybrake’s official GitHub repo.