{"id":9718,"library":"edx-django-utils","title":"edx-django-utils","description":"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.","status":"active","version":"8.0.1","language":"en","source_language":"en","source_url":"https://github.com/openedx/edx-django-utils","tags":["django","openedx","utilities","middleware","monitoring","apm"],"install":[{"cmd":"pip install edx-django-utils","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core framework the utilities extend and integrate with.","package":"Django","optional":false},{"reason":"Used for Datadog APM integration in monitoring utilities.","package":"ddtrace","optional":false},{"reason":"Used for Elastic APM integration in monitoring utilities.","package":"elastic-apm","optional":false},{"reason":"General utility dependency.","package":"pyyaml","optional":false}],"imports":[{"symbol":"MonitoringMiddleware","correct":"from edx_django_utils.monitoring.middleware import MonitoringMiddleware"},{"symbol":"set_monitoring_transaction_name","correct":"from edx_django_utils.monitoring.utils import set_monitoring_transaction_name"},{"symbol":"IdentityContextMiddleware","correct":"from edx_django_utils.middleware.identity import IdentityContextMiddleware"}],"quickstart":{"code":"# In your Django project's settings.py\nINSTALLED_APPS = [\n    # ... other apps\n    'edx_django_utils.plugins', # Required for some signals/plugin management features\n    # ...\n]\n\nMIDDLEWARE = [\n    'edx_django_utils.monitoring.middleware.MonitoringMiddleware',\n    'edx_django_utils.middleware.identity.IdentityContextMiddleware',\n    # ... other middleware\n]\n\n# Example usage in a view or management command\nfrom django.http import HttpResponse\nfrom edx_django_utils.monitoring.utils import set_monitoring_transaction_name\n\ndef my_app_view(request):\n    set_monitoring_transaction_name('my_app.view_name')\n    # Your view logic\n    return HttpResponse('Response from my app!')","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher. For new projects, use Python 3.11+.","message":"Python 3.8 support was dropped in `edx-django-utils==6.0.0`.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Explicitly add `newrelic` to your project's dependencies (e.g., `pip install newrelic`).","message":"The `newrelic` package was removed as a direct dependency in `edx-django-utils==8.0.0`. If your project relied on `edx-django-utils` to implicitly install `newrelic` for monitoring, you will need to add it to your project's `requirements.txt` explicitly.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Review your `MIDDLEWARE` settings and replace or remove any deprecated `edx_django_utils` middleware. Refer to the official documentation or release notes for current alternatives.","message":"Several middleware classes, such as `RequestCacheMiddleware`, were deprecated and subsequently removed or refactored in `v7.2.0`.","severity":"deprecated","affected_versions":">=7.2.0"},{"fix":"Ensure `edx-django-utils` is at least `7.3.0` or newer when using Django 5.2 or later.","message":"Django 5.2 support was explicitly added in `edx-django-utils==7.3.0`. While earlier versions might work, full compatibility and optimal behavior with Django 5.2 are ensured from this version onwards.","severity":"gotcha","affected_versions":"<7.3.0 (with Django 5.2)"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Add `newrelic` explicitly to your project's `requirements.txt` or `pyproject.toml` and reinstall your dependencies (e.g., `pip install newrelic`).","cause":"Upgrading to `edx-django-utils>=8.0.0` removed `newrelic` from its direct dependencies, but your project still expects it.","error":"ModuleNotFoundError: No module named 'newrelic'"},{"fix":"Remove `RequestCacheMiddleware` from your Django `MIDDLEWARE` settings. Check the `edx-django-utils` changelog for suitable alternatives if its functionality is still required.","cause":"The `RequestCacheMiddleware` class was deprecated and removed/refactored in `edx-django-utils>=7.2.0`.","error":"ImportError: cannot import name 'RequestCacheMiddleware' from 'edx_django_utils.middleware.request'"},{"fix":"Upgrade your Python environment to 3.9 or higher. For example, use Python 3.9, 3.10, or 3.11.","cause":"`edx-django-utils>=6.0.0` dropped support for Python 3.8.","error":"raise UnsupportedPythonVersion(f\"Unsupported Python version: {sys.version_info}\") # pragma: no cover"}]}