bottle
bottle copied to clipboard
Is there an obvious way to set jinja2 environment attributes?
I want to use jinja-assets-compressor in our bottlepy based platform.
Is there an easy way to override default Bottle Jinja Environment?
Ok, it IS pretty obvious:
Jinja2Template.settings = { 'extensions': [CompressorExtension] }
Ok, thats how you add extension on bottlepy Jinja2 env.
I actually want to set some attributes on JInja2 Environment: For instance this is the process described on jinja-assets-compressor:
env = jinja2.Environment(extensions=[CompressorExtension]) env.compressor_output_dir = './static/dist' env.compressor_static_prefix = '/static' env.compressor_source_dirs = './static_files'
With bottle we can replace the first line with:
bottle.Jinja2Template.settings = { 'extensions': [CompressorExtension] }
But so far i was unable to replace the other lines? any suggertsions?