Installing Airbrake in a Django app

python flag

Features

  • Simple to install and configure
  • Automatically report exceptions from your django app
  • Compatible with Airbrake on-premise

Installation

pip install git+https://github.com/airbrake/airbrake-django.git

Configuration

To configure airbrake you will need to add airbrake to your INSTALLED_APPS and create the AIRBRAKE dictionary. Add airbrake to INSTALLED_APPS in your settings.py:

INSTALLED_APPS = (
    'django.contrib.admin',
    # ...
    'airbrake'
)

Create the AIRBRAKE dictionary in your settings.py for project:

# Airbrake settings
AIRBRAKE = {
    'API_KEY': 'YOUR_PROJECT_API_KEY',
    'TIMEOUT': 5,
    'ENVIRONMENT': 'production',
}

Then just restart your server!

Automatically sending errors

MIDDLEWARE = (
    ...,
    'airbrake.middleware.AirbrakeNotifierMiddleware'
)

Going further

Please visit our official GitHub repo for details on manually sending errors, additional configuration options, and more.