wagtail-template
wagtail-template copied to clipboard
Include a basic context_processors.py
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
)