--- id: django-cid version: "3.0" license: BSD-3-Clause license_treatment: permissive maintenance: dormant --- # django-cid — Correlation IDs in Django for debugging requests License: permissive · Maintenance: dormant · Downloads: 129.3K/mo ## What it is and what it does Django Correlation ID is a middleware package that assigns a unique identifier to each incoming HTTP request and propagates it through the Django request/response cycle. This correlation ID can be automatically embedded in all log messages, SQL query comments, rendered templates, and HTTP response headers, making it easy to trace which log entries belong to the same request when debugging multi-request scenarios. The package solves the problem of log attribution in complex systems where multiple requests are processed concurrently. Instead of manually threading request IDs through your codebase, django-cid handles this automatically via middleware, allowing you to correlate all side effects of a single request without explicit plumbing. It's particularly useful in service-oriented architectures where you need to pass the correlation ID to downstream services. Use it for: - Trace all log messages belonging to a single user request across multiple application components and services. - Debug production issues by filtering logs by correlation ID to isolate the request that caused a problem. - Include correlation IDs in SQL query comments to link database activity to specific HTTP requests. - Pass correlation IDs to downstream microservices via HTTP headers to maintain request tracing across service boundaries. - Render correlation IDs in error pages or response headers for customer support reference. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Assigns unique correlation IDs to incoming HTTP requests and automatically includes them in Django logs, SQL queries, templates, and HTTP response headers to trace related log messages across a request lifecycle. Yes, if you use Django and need request tracing for debugging. The package is stable, has low install friction, and solves a real problem in multi-request logging scenarios. The dormant maintenance status is acceptable for a mature, feature-complete tool—no active vulnerabilities and it supports current Django and Python versions. Install it if request correlation is important to your logging strategy. ## Install pip install django-cid uv add django-cid poetry add django-cid ## Installing django-cid Before you install: Low install friction with a single runtime dependency on django. Maintenance is dormant—no releases since May 2024, though the repository remains active and the package is marked Production/Stable. Suitable for stable projects that don't require frequent updates. License in practice: BSD-3-Clause is a permissive open-source license. You may use, modify, and distribute this package freely in commercial and private projects, provided you include the license text and do not hold the authors liable. Quickstart: pip install django-cid # In Django settings.py, add to MIDDLEWARE: MIDDLEWARE = [ 'django_cid.middleware.CIDMiddleware', # ... ] # Correlation ID is then available in logs and can be accessed via: from django_cid import get_cid cid = get_cid() Requires Django >= 3.1 and Python >= 3.8. Verify before relying: - Whether the package works with Django versions beyond 4.2 (latest tested version in classifiers). - Performance impact of automatic SQL query annotation on high-throughput applications. - Compatibility with async Django views and middleware. ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 129.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django request correlation id, request tracing logging, django request id tracking, correlation id middleware, trace requests across logs, django debugging request flow, request lifecycle tracking, request-tracing, django-middleware, logging-instrumentation [View on SkillFed](https://skillfed.io/packages/django-cid) · [View on PyPI](https://pypi.org/project/django-cid/)