Context Processors in 100 words

Context processors are functions, typically quite simple, that add data to the context every time you render a template. The best example of a context processor is the one that adds the user object to the context. This one is enabled by default inside Django, but it saves you having to remember to add the following code to every view.

def my_view(request):
    return render('index.html'
            # THIS Line
            'user': request.user

and instead you have this single function:

def my_context_processor(request):
    return {
        'user': request.user

Having too many context processors would add undue load to the rendering process as they affect every view so do take caution when adding them.

Commone use cases for context processors are passing settings and feature flags.

Finally the quick how to, step 1 write your function and return a dictionary. Step 2 add the python dotted path into the TEMPLATES settings with the other context processors. Done!

A day later edit: Bapiste pointed out that I got it slightly wrong. Context processors are only used when the RequestConext is used, which is by default with the render shortcut function which was introduced in Django 1.3. See here for the discussion