In cfehome/context_processors.py add:
def my_context(request):
# caching
return {
"my_var": "hello world"
}Replace cfehome with any given Django app and/or configuration module.
Update settings.py to:
TEMPLATES = [
{
...
'OPTIONS': {
'context_processors': [
...
'cfehome.context_processors.my_context',
],
},
},
]In any of your Django templates, you can now use my_var as you see fit:
{% extends "base.html" %}
{% block content %}
{{ my_var }}
{% endblock %}