为什么我不能在某些模板中使用自定义context_processor? 在邮件模板上,它不起作用,或在扩展主页的模板上。
context_processor.py:
from django.conf import settings
def settings_processor(request):
my_dict = {
'SITE_URL': '%s%s' % ('https://' if request.is_secure() else 'http://', request.META['HTTP_HOST']),
'SITE_NAME': settings.SITE_NAME,
'LANG': 'asdasdsa'
}
return my_dict
settings.py:
TEMPLATE_CONTEXT_PROCESSORS = TCP + (
'django.core.context_processors.request',
'project.context_processors.settings_processor',
)