Skip to main content

A simple way to implement request_id in Django

Project description

Request ID Django Log

Build Status Maintainability Test Coverage Coverage Status PyPI version Code style: black Say Thanks!

Install

pip install request-id-django-log

Update your INSTALLED_APPS and MIDDLEWARE

INSTALLED_APPS = [
    ...
    "request_id_django_log",
]
MIDDLEWARE = [
    ...
    "request_id_django_log.middleware.RequestIdDjangoLog",
]

Configure

The following options are used by this library:

REQUEST_ID_CONFIG = {
    "REQUEST_ID_HEADER": "HTTP_X_REQUEST_ID",
    "GENERATE_REQUEST_ID_IF_NOT_FOUND": True,
    "RESPONSE_HEADER_REQUEST_ID": "HTTP_X_REQUEST_ID",
}
  • REQUEST_ID_HEADER is the header name which will hold the received request_id. This must be used when another system is responsible for generating the request_ids and sending them to your django application.
  • GENERATE_REQUEST_ID_IF_NOT_FOUND If set to true, a new request_id will be generated if none was previously supplied.
  • RESPONSE_HEADER_REQUEST_ID sets the name of the response header which will hold the value of the request_id.

Supported Versions

  • python 2.7 with Django 1.8, 1.9 and 1.11
  • python 3.5, 3.6 and 3.7 with Django 1.8, 1.9, 1.11, 2.0 and 2.1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for request-id-django-log, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size request_id_django_log-0.1.1-py3-none-any.whl (7.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size request_id_django_log-0.1.1.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page