edx-django-utils

8.0.1 · active · verified Fri Apr 17

edx-django-utils provides a collection of utility functions, middleware, and helpers for developing Django applications within the Open edX ecosystem. It offers features like monitoring integration, plugin management, and common middleware components. The current version is 8.0.1, and it maintains an active development cycle with frequent patch, minor, and occasional major releases addressing new features, bug fixes, and dependency updates.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to integrate edx-django-utils by adding its `MonitoringMiddleware` and `IdentityContextMiddleware` to your Django `MIDDLEWARE` settings, including `edx_django_utils.plugins` in `INSTALLED_APPS`, and using the `set_monitoring_transaction_name` utility function within a view.

# In your Django project's settings.py
INSTALLED_APPS = [
    # ... other apps
    'edx_django_utils.plugins', # Required for some signals/plugin management features
    # ...
]

MIDDLEWARE = [
    'edx_django_utils.monitoring.middleware.MonitoringMiddleware',
    'edx_django_utils.middleware.identity.IdentityContextMiddleware',
    # ... other middleware
]

# Example usage in a view or management command
from django.http import HttpResponse
from edx_django_utils.monitoring.utils import set_monitoring_transaction_name

def my_app_view(request):
    set_monitoring_transaction_name('my_app.view_name')
    # Your view logic
    return HttpResponse('Response from my app!')

view raw JSON →