return jinja2 template environment per docs

Use the alias 'jinja2' to look up the jinja2 template engine per https://docs.djangoproject.com/en/1.9/topics/templates/#django.template.loader.engines
This commit is contained in:
thenewguy
2016-01-18 23:23:24 -05:00
parent 88642c4585
commit 39e6ab973a

View File

@@ -73,13 +73,10 @@ class CompressorConf(AppConf):
# Returns the Jinja2 environment to use in offline compression. # Returns the Jinja2 environment to use in offline compression.
def JINJA2_GET_ENVIRONMENT(): def JINJA2_GET_ENVIRONMENT():
alias = 'Jinja2' alias = 'jinja2'
try: try:
from django.template.loader import _engine_list from django.template import engines
engines = _engine_list(alias) return engines[alias].env
if engines:
engine = engines[0]
return engine.env
except InvalidTemplateEngineError: except InvalidTemplateEngineError:
raise InvalidTemplateEngineError( raise InvalidTemplateEngineError(
"Could not find config for '{}' " "Could not find config for '{}' "