django-request-id
Augment each request with unique id for logging purposes
What it is and what it does
django-request-id is a Django middleware package that automatically assigns a unique identifier to each incoming HTTP request and makes it available throughout the request lifecycle. It integrates with Django's standard logging system via a custom filter, allowing you to include the request ID in log messages by adding a `%(request_id)` placeholder to your formatter. This enables correlation of log entries across your web server (Nginx, Apache, Heroku) and Django application, making it easier to trace a single user's request through your system.
The package retrieves the request ID from an HTTP header (typically `X-Request-ID`, configurable via `REQUEST_ID_HEADER` setting) if your web server provides one, or generates a unique ID automatically if not. It requires no external dependencies and integrates via a simple middleware registration and logging configuration. However, the package has not been maintained since 2021 and targets older Django and Python versions, so compatibility with current releases is uncertain.
Use it for:
- Correlate log entries between Nginx/Apache web server logs and Django application logs for a single request
- Trace a user's request through multiple services or background tasks by passing the request ID as a header
- Debug production issues by matching a specific request ID in server logs to corresponding application log entries
- Implement request-scoped logging context in Django views and middleware without manual ID threading
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Attaches a unique request ID to each Django HTTP request and integrates it into Python logging, enabling request tracing across server and application logs.
No. While the package is simple and has no dependencies, it is abandoned (last update 2021-01-11) and targets Django 1.8–1.10 and Python 2.7 / 3.3–3.5. Modern Django and Python versions are likely unsupported. For current projects, consider a maintained alternative or implement request ID tracking directly using Django's built-in logging context or third-party solutions actively maintained for modern Django.
Install
django-request-id on PyPI
pip
pip install django-request-iduv
uv add django-request-idpoetry
poetry add django-request-idInstalling django-request-id
Before you install
Installation is frictionless with no runtime dependencies. However, the package is abandoned—last commit was 2021-01-11 and it has not been updated for over 3 years. It targets Django 1.8–1.10 and Python 2.7 / 3.3–3.5, making it potentially incompatible with modern Django and Python versions.
License in practice
Released under the MIT license (permissive), so you may use, modify, and distribute it freely in both open-source and commercial projects without restriction.
Quickstart
# Install
pip install django-request-id
# In Django settings.py:
INSTALLED_APPS = [
'request_id',
# ...
]
MIDDLEWARE = [
'request_id.middleware.RequestIdMiddleware',
# ...
]
# In a view:
from django.http import HttpResponse
def my_view(request):
request_id = request.request_id
return HttpResponse(f'Request ID: {request_id}')
Requires Django and Python versions compatible with 1.8–1.10 and 2.7 / 3.3–3.5 respectively; modern Django and Python versions may not be supported.
Verify before relying
- Whether the package works with Django versions released after 1.10 (2.0+, 3.x, 4.x, 5.x)
- Whether the package is compatible with Python 3.6 and later versions
- Current status of any community forks or maintained alternatives
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,582 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 116,397/month — #12,206 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_request_id-1.0.0-py2.py3-none-any.whl
Keywords: django, request-id
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
django-log-request-idAttaches a unique request ID to every log…
permissive · top 15,000 on PyPI
Flask-Log-Request-IDExtracts request IDs from incoming HTTP…
permissive · top 15,000 on PyPI
flask-request-id-headerFlask middleware that automatically adds or…
unclear · top 15,000 on PyPI
django-guidAttaches a unique correlation ID to all logs…
permissive · top 15,000 on PyPI
asgi-correlation-idASGI middleware that reads or generates…
permissive · top 5,000 on PyPI
django-structlogIntegrates structured logging into Django…
permissive · top 5,000 on PyPI
django-datadog-loggerIntegrates Django applications with Datadog…
permissive · top 15,000 on PyPI
django-currentuserStores a reference to the currently logged-in…
permissive · top 15,000 on PyPI
starlette-contextMiddleware for Starlette that stores and…
permissive · top 5,000 on PyPI
django-cprofile-middlewareMiddleware that profiles Django view execution…
permissive · top 15,000 on PyPI