Skip to content

Environments

Honeybadger groups errors by the environment they belong to. The default environment is “production”, but you can set it to different values such as “staging” or “development” depending on where your app is running.

You can set the environment by calling the honeybadger.configure method:

from honeybadger import honeybadger
honeybadger.configure(api_key='redacted', environment='development')

You can also set the environment using the HONEYBADGER_ENVIRONMENT environment variable:

Terminal window
export HONEYBADGER_ENVIRONMENT="staging"

Some environments should usually not report errors at all, such as when you are developing on your local machine or running your test suite (locally or in CI). The honeybadger package has an internal list of environment names which it considers development environments:

development
dev
test

Honeybadger does not report errors in these environments. To always send data regardless of the environment, you can set the force_report_data to True:

from honeybadger import honeybadger
honeybadger.configure(
api_key='redacted',
environment='development',
force_report_data=True
)

If you have development environments that aren’t part of the default list, you can set the development_environments configuration option to meet your needs:

from honeybadger import honeybadger
honeybadger.configure(
api_key='redacted',
environment='staging',
development_environments=['development', 'dev', 'test', 'staging']
)

This will ensure that errors are not sent in the specified environments.

When using Django, if DEBUG = True is set in your Django settings, Honeybadger will automatically set the environment to “development”. This can be overridden by explicitly setting the environment in your Honeybadger configuration or using the HONEYBADGER_ENVIRONMENT environment variable.

For more configuration options, see Configuration.