A context processor is a Python function that takes the request object as an argument and returns a dictionary that gets added to the request context. They come in handy when you need to make something available globally to all templates.
By default, when you create a new project using the startproject command, your project contains the following template context processors, in the context_processors option inside the TEMPLATES setting:
- django.template.context_processors.debug: This sets the boolean debug and sql_queries variables in the context representing the list of SQL queries executed in the request.
- django.template.context_processors.request: This sets the request variable in the context.
- django.contrib.auth.context_processors.auth ...