torchbox / wagtail-template

A Django template for starting new Wagtail projects with Vagrant. NO LONGER MAINTANED
19 stars 8 forks source link

Include a basic context_processors.py #13

Open davecranwell opened 9 years ago

davecranwell commented 9 years ago

Several recent wagtail projects have added a custom context processor to provide global variables to the template stack, which have proved enormously helpful.

It would be worth adding a very basic file to the template e.g:

import urllib

from django.conf import settings

def global_pages(request):
    return {
        'BASE_URL': getattr(settings, 'BASE_URL', ""),
        'DEBUG': getattr(settings, 'DEBUG', ""),
    }

(BASE_URL is manually defined in a settings file, and is in lieu of a more dynamic way of finding the base URL of a Site for any given Page)