--- id: django-guid version: "3.6.1" license: MIT license_treatment: permissive maintenance: active --- # django-guid — Middleware that enables single request-response cycle tracing by injecting a unique ID into project logs License: permissive · Maintenance: active · Downloads: 251.7K/mo ## What it is and what it does Django GUID is middleware that injects a unique correlation ID into every request-response cycle and makes it available to your application's logging system. When configured, all log messages generated during a request automatically include that request's ID in brackets, allowing you to group and trace all logs belonging to a single user action or request across multiple functions, services, and middleware layers. The package works with both ASGI and WSGI servers and stores the correlation ID using ContextVar for thread-safe access. It can accept an incoming correlation ID from a request header (validating it as a UUID if configured), generate a new one if none is provided, and optionally return the ID in the response headers. It also supports integrations with tools like Sentry to synchronize the correlation ID with external tracing systems. Use it for: - Debugging production issues by filtering logs for a single user's request ID to see the full execution path - Correlating logs across microservices when a correlation ID is passed between services in request headers - Integrating with Sentry or similar error tracking to tag exceptions with the same request ID used in application logs - Auditing and compliance: tracking which requests touched which data by following the correlation ID through logs - Performance analysis: identifying slow requests by tracing all operations within a single correlation ID ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Attaches a unique correlation ID to all logs for every Django request, making it easy to trace related log entries across your application. Yes. This is a stable, actively maintained package with low install friction, no security vulnerabilities, and a clear, focused purpose. It integrates cleanly into Django's middleware stack and requires minimal configuration. Install it if you need to correlate logs across a single request or trace requests through a distributed system. ## Install pip install django-guid uv add django-guid poetry add django-guid ## Installing django-guid Before you install: Low friction install with only two runtime dependencies (django and packaging). The package is actively maintained with a recent release and no known vulnerabilities. License in practice: Licensed under MIT, a permissive open-source license with minimal restrictions on use, modification, and distribution. Quickstart: pip install django-guid # In settings.py: INSTALLED_APPS = ['django_guid', ...] MIDDLEWARE = ['django_guid.middleware.guid_middleware', ...] LOGGING = { 'filters': {'correlation_id': {'()': 'django_guid.log_filters.CorrelationId'}}, 'formatters': {'medium': {'format': '%(levelname)s [%(correlation_id)s] %(name)s %(message)s'}}, 'handlers': {'console': {'class': 'logging.StreamHandler', 'filters': ['correlation_id']}} } Requires Django 3.1.1 or above for ASGI/WSGI support; earlier Django versions require django-guid 2.x with WSGI-only support. Verify before relying: - Whether the package supports Django versions below 3.1.1 or only 3.1.1 and above as stated in the description - Performance impact of correlation ID injection on high-throughput applications - Compatibility with custom logging handlers beyond the standard configuration shown ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 251.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django request tracing, correlation id logging, request id middleware, django guid logging, trace requests across logs, django request tracking, asgi wsgi request id, request-tracing, logging-middleware, asgi-wsgi [View on SkillFed](https://skillfed.io/packages/django-guid) · [View on PyPI](https://pypi.org/project/django-guid/)