{"id":23068,"library":"django-cid","title":"django-cid","description":"Adds correlation IDs (CID) to Django requests for tracing and debugging. Currently at version 3.0, requires Python >=3.8. Active development with periodic releases.","status":"active","version":"3.0","language":"python","source_language":"en","source_url":"https://github.com/Polyconseil/django-cid","tags":["django","correlation-id","tracing","debugging","middleware"],"install":[{"cmd":"pip install django-cid","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"Core framework requirement.","package":"django","optional":false}],"imports":[{"wrong":"from cid.middleware import CorrelationIdMiddleware","symbol":"CorrelationIdMiddleware","correct":"from cid import CorrelationIdMiddleware"}],"quickstart":{"code":"import os\n\n# Add to MIDDLEWARE in settings:\nMIDDLEWARE = [\n    'cid.middleware.CorrelationIdMiddleware',\n    # ...\n]\n\n# Then in views:\nfrom cid import get_cid\n\ndef my_view(request):\n    cid = get_cid(request)\n    return HttpResponse(f'Correlation ID: {cid}')","lang":"python","description":"Basic setup: add middleware and use get_cid() to retrieve the correlation ID."},"warnings":[{"fix":"Replace 'cid.middleware.CIDMiddleware' with 'cid.middleware.CorrelationIdMiddleware' in MIDDLEWARE settings.","message":"Middleware renamed from CIDMiddleware to CorrelationIdMiddleware in v3.0. Old imports will cause ImportError.","severity":"breaking","affected_versions":"<3.0 -> >=3.0"},{"fix":"Change 'from cid.utils import get_cid' to 'from cid import get_cid'.","message":"get_cid function moved from cid.utils to cid top-level. Old import path broken.","severity":"breaking","affected_versions":"<3.0 -> >=3.0"},{"fix":"Pass cid to template context manually: context['cid'] = get_cid(request).","message":"The 'cid' template tag and context processor were removed in v3.0. Use get_cid directly in views or templates via template context.","severity":"deprecated","affected_versions":">=3.0"},{"fix":"Ensure CorrelationIdMiddleware is early in the MIDDLEWARE list (e.g., after CommonMiddleware but before SessionMiddleware).","message":"CorrelationIdMiddleware must be placed before other middlewares that need to access the CID, otherwise get_cid will return None.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'3.0':18 '3.8':21 'activ':22 'add':4 'cid':3,7 'correl':5,29 'correlation-id':28 'current':15 'debug':14,32 'develop':23 'django':2,9,27 'django-cid':1 'id':6,30 'middlewar':33 'period':25 'python':20 'releas':26 'request':10 'requir':19 'trace':12,31 'version':17","created_at":"2026-05-01T06:02:16.044493+00:00","updated_at":"2026-05-01T06:02:16.044493+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'CorrelationIdMiddleware' from 'cid' (/tmp/tmp5ezmqjdg/venv/lib/python3.12/site-packages/cid/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://django-correlation-id.readthedocs.io/","github":"https://github.com/Polyconseil/django-cid","docs":"https://django-correlation-id.readthedocs.io/","changelog":"https://django-correlation-id.readthedocs.io/en/latest/history.html","pypi":"https://pypi.org/project/django-cid/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","observability","auth-security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}