Supported Versions
- Django 1.11 and above.
Installation steps
-
Install the Atatus python agent:
Option 1: Install the agent using pip.
Option 2: Add
atatusto your project’s requirements.txt file, and install the agent using pip. -
Add
atatus.contrib.djangotoINSTALLED_APPSin your settings.py: -
Add license key and app name in your settings.py:
- 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.
-
Open your project’s
asgi.pyfile. -
Update it to include the
ASGITracingMiddleware:
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.
-
Create or open the
middleware.pyfile in your Django application. -
Add the following code to
middleware.py: -
Add
CustomTracingMiddlewareto your middleware configuration in yoursettings.pyfile:Make sureCustomTracingMiddlewareis included in the order that best fits your middleware needs.
Step 4: Configure Atatus
-
Add
atatus.contrib.djangotoINSTALLED_APPSin your settings.py: -
Add license key and app name in your settings.py:
'LICENSE_KEY' with your actual license key. You can adjust the configuration options based on your tracing needs.