lektor-website/content/docs/api/plugins/events/setup-env/contents.lr

20 lines
496 B
Plaintext
Raw Normal View History

2015-12-19 14:52:17 +01:00
title: setup-env
---
type: event
---
summary: Emitted right after the plugin is associated with the environment.
---
body:
This event is emitted right after the plugin was initialized and associated
with the [environment :ref](../../../environment/). This can be used to
reconfigure it. For instance this is the perfect place to inject Jinja 2
filters and global variables.
## Example
```python
def on_setup_env(self, **extra):
2017-04-25 09:22:00 +02:00
self.env.jinja_env.globals['my_variable'] = 'my value'
2015-12-19 14:52:17 +01:00
```