niwinz / django-jinja

Simple and nonobstructive jinja2 integration with Django.
http://niwinz.github.io/django-jinja/latest/
BSD 3-Clause "New" or "Revised" License
363 stars 102 forks source link

Use with Django-Compressor - get environment #225

Closed Yobmod closed 2 years ago

Yobmod commented 6 years ago

I'm using Django-Compressor with Jinja 2. It all works fine with django-jinja using Compressor's extension, until I try to do Offline Compression. Compressor needs a setting (COMPRESS_JINJA2_GET_ENVIRONMENT) to be set to a function that returns the jinja2 environment.

I couldn't see any way to do this with django-jinja in the docs. Is there a get_env() type function? Or a way create an env with all the same settings?

I've tied importing the backend.Jinja2 class and feeding it the setting from TEMPLATES, but it gives me a a KeyError: 'NAME'

Edit: Ah, I found the same issue in the closed issues, with a solution Might be worth adding to the docs?

Thx for the great lib!

wizpig64 commented 2 years ago

closing as duplicate of #217.