> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AppSignal Python Configuration

This documentation explains how to configure AppSignal. For more information on installing AppSignal, follow the steps in our [installation documentation](/python/installation/).

### Application Environment

By default, the AppSignal for Python integration will report the current application in the "development" environment. You can use the `environment` configuration option to set a different environment. For example, in your `__appsignal__.py` file:

<CodeGroup>
  ```python Python theme={null}
  # __appsignal__.py
  appsignal = Appsignal(
      # ...
      environment="production"
  )
  ```
</CodeGroup>

You can also use the `APPSIGNAL_APP_ENV` environment variable.

### Reporting Deploys

You can use [Deploy Markers](/application/markers/deploy-markers) to report new deploys of your Python application. You can combine Deploy Markers with [Backtrace Links](/application/backtrace-links) to directly link from AppSignal to the source code on platforms like GitHub and GitLab.

Deploy markers can be configured using the `revision` config option or the `APP_REVISION` environment variable. We recommend using Git commit SHAs or a tag in your SCM. For example, for Git applications, add the following code to the `__appsignal__.py` file:

<CodeGroup>
  ```python Python theme={null}
  # __appsignal__.py
  import subprocess

  revision = None

  try:
      revision = subprocess.check_output(
          "git rev-parse --short HEAD", shell=True, text=True
      ).strip()
  except subprocess.CalledProcessError:
    pass

  appsignal = Appsignal(
      # ...
      revision=revision
  )
  ```
</CodeGroup>

## Importing the Configuration File

The AppSignal for Python integration needs to be loaded and started in your application. To load and start the integration, import the `appsignal` module and call the `appsignal.start()` method on app start or in the `main` method.

<Tip>
  AppSignal also supports popular web frameworks directly, such as
  [Django](/python/instrumentations/django),
  [Flask](/python/instrumentations/flask),
  [FastAPI](/python/instrumentations/fastapi) or
  [Starlette](/python/instrumentations/starlette). If you're using a web
  framework we support directly, follow the instructions for that framework
  instead of the generic instructions on this page.
</Tip>

<CodeGroup>
  ```python Python theme={null}
  # Your app file

  # Add this import statement
  import appsignal

  def main():
      # Add this method call
      appsignal.start()


  if __name__ == '__main__':
      main()
  ```
</CodeGroup>

## Add Instrumentation Packages

The next step is to instrument Python libraries such as Django, Celery, etc. Instrumenting libraries will provide a broader set of monitoring data, allowing you to understand your application's performance better.

You can read more about installing and configuring instrumentations in our [Python instrumentations documentation][instrumentations].

[Python language]: https://www.python.org/

[OpenTelemetry]: https://opentelemetry.io/

[instrumentations]: /python/instrumentations

[django]: /python/instrumentations/django.html
