Skip to main content

Python installation and configuration by manual installation

Use this workflow with the Add New Python agent wizard to ensure you have all the steps covered for manually installing and configuring the Python agent. Using the wizard is the simplest way to deploy a new agent.

Before you begin

Make sure you have everything you need before you start.

  • The agent will need to be able to reach your Contrast instance. It can be a local/on-premise instance or a hosted instance. A proxy can be configured if the environment has limited network access.

  • It must use supported versions, frameworks, and tools

  • Understand the order of precedence

  • You will also need access to a command line interface (with a chosen directory for downloading the agent) and your organization's instance of Contrast

Start the Python agent wizard

  1. Open the agent wizard:

    • Northstar: From the left navigation, select Administration > Agent management. Then, select Add agent at the top of the view.

    • Contrast: Use either of these options:

      • From the header, select Add New and then, select the Application card.

      • Select Administration > Agent management. Then, select Add agent at the top of the view.

  2. Under Select a language, select Python.

  3. Under Select Operating System, select Linux or macOS.

Install the agent

  1. Under Select application deployment method, select Install manually.

  2. Under Install agent, install the agent using your preferred package manager.

Configure the agent

Under Configure the agent, select the best options to get the configuration details that the agent needs to communicate with Contrast:

  1. Optionally, select Register the application.

    When you register an application, you can assign it to groups for access control. You can also assign tags and metadata to the application.

  2. Select Use Connection Token.

    This configuration method uses a single variable to specify authentication values.

    Copy the displayed code and set the variable in a location where the agent has access to it.

  3. If you prefer to configure the agent using a YAML file, select Download configuration.

    Copy the displayed code to generate a YAML file that contains your authentication settings.

    Note

    On Linux, if you receive a Permission denied error, raise your permissions to write the configuration file to /etc/contrast/. Alternatively, you can download contrast_security.yaml from the configuration editor and place the file in a supported YAML file location.

  4. Start your application with the Contrast Runner.

    For example, for a WSGI application that is started with the following command:

    gunicorn myproject.wsgi:application

    Run the following command to add Contrast to this application:

    contrast-python-run -- gunicorn myproject.wsgi:application

    The double dash separator -- separates the runner command's arguments from ones that belong to the original command.

Verify the agent deployment

  1. Interact with your application as you normally would. For example, interact with your application's web interface or send API commands.

  2. Select Administration, then Agent management to verify that your agent appears in the list.

  3. Verify that you see the name of your application in the list.

  4. Select Servers in the header.

  5. Verify that you see the name of your local server in the list.