AppSignal for Python load order

This documentation outlines how the AppSignal configuration is loaded in your Python application.

There are two different methods for configuring your AppSignal integration, which can be used simultaneously:

  • Config file (__appsignal__.py)
  • Environment variables

A list of available options can be found in the Configuration options documentation.

Load order

The configuration is loaded in a four-step process:

  1. Package defaults - default
  2. System detected settings - system
  3. Environment variables - env
  4. Initial configuration - initial

1. Package defaults

First, the default configuration is loaded, which sets paths and enables certain features.

This source will be listed under default in your application's config and is visible in the Diagnose report.

2. System detected settings

The package detects what kind of system it's running on and configures itself accordingly.

For example, if running inside a container-based system such as Docker or Heroku, the configuration option running_in_container is set to true.

This source will be listed under system in your application's config and is visible in the Diagnose report.

3. Environment variables

AppSignal will look for Configuration options set via Environment variables. The Environment variable value will override values for the same Configuration options defined in previous steps.

bash
export APPSIGNAL_APP_NAME="my custom app name" # start your app here

This source will be listed under env in your application's configuration, and is visible in the Diagnose report.

4. Initial configuration given to Appsignal

Finally, the initial configuration is loaded via the Appsignal function called from the __appsignal__.py config file:

ruby
# __appsignal__.py appsignal = Appsignal( active=True, name="My app name", push_api_key="00000000-0000-0000-0000-000000000000" )

The values of Conig options defined in this step will override values for the same Configuration options defined in previous steps.

This source will be listed under initial in your application's config and is visible in the Diagnose report.