wagtail-template icon indicating copy to clipboard operation
wagtail-template copied to clipboard

Include a basic context_processors.py

Open davecranwell opened this issue 9 years ago • 0 comments

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)

davecranwell avatar Oct 28 '14 09:10 davecranwell