Quickstart
Installation
Install the package:
python -m pip install django-unused-context
Add the middleware to your Django
settings.pyfile:MIDDLEWARE = [ 'django_unused_context.middleware.UnusedContextMiddleware', ... ]
Ensure that you have
DEBUGset toTruein your Djangosettings.pyfile:DEBUG = True
Usage
Usage is automatic once the middleware is added. On each response that renders a template, any variables that were added to the template’s context and then not used in the template rendering will be added to an internal set that will be both logged out and raise warnings. This is useful for knowing that all variables being sent to a template are being used.
See the Configuration section for more information on customizing how django-unused-context operates.