Supported Versions

  • Django 1.11 and above.

Installation steps

  1. Install the Atatus python agent: Option 1: Install the agent using pip.
    Option 2: Add atatus to your project’s requirements.txt file, and install the agent using pip.
  2. Add atatus.contrib.django to INSTALLED_APPS in your settings.py:
  3. Add license key and app name in your settings.py:
  4. Restart your Django server

Installation steps for Django 5+ with ASGI

Here’s a step-by-step guide on setting up Django 5 with ASGI using custom middleware for Atatus tracing:

Step 1: Install Required Dependencies

Ensure that Atatus are installed in your environment. Run the following command to install these dependencies if you haven’t already:

Step 2: Integrate ASGI Tracing Middleware in asgi.py

Django 5 is ASGI-compatible, so the ASGITracingMiddleware will wrap the ASGI application to capture and trace async requests.
  1. Open your project’s asgi.py file.
  2. Update it to include the ASGITracingMiddleware:
This wraps your ASGI application with Atatus tracing, allowing for async request tracking.

Step 3: Configure CustomTracingMiddleware

This custom middleware extends Atatus’s TracingMiddleware to add specific transaction naming logic based on the request’s path and view name.
  1. Create or open the middleware.py file in your Django application.
  2. Add the following code to middleware.py:
  3. Add CustomTracingMiddleware to your middleware configuration in your settings.py file:
    Make sure CustomTracingMiddleware is included in the order that best fits your middleware needs.

Step 4: Configure Atatus

  1. Add atatus.contrib.django to INSTALLED_APPS in your settings.py:
  2. Add license key and app name in your settings.py:
Replace 'LICENSE_KEY' with your actual license key. You can adjust the configuration options based on your tracing needs.

Step 5: Restart your Django server

After configuring the middleware and ASGI setup, restart your Django server to apply the changes. This will ensure that your custom middleware and ASGI tracing are active. Once the server restarts, test by making requests to your application, and verify in Atatus that transactions and traces are being recorded.