jinja2_getenv_extension
Status (master branch)
What is it ?
This is a jinja2 extension to access to system environment variables. It is usefull if you have dynamically generated variable names.
Syntax
The syntax is {{ 'ENV_VAR'|getenv }} to access to the ENV_VAR environment
variable. Don't forget the quotes around ENV_VAR !
If you want to provide a default value to avoid an exception if the corresponding
environment variable does not exist, you can use the following syntax:
{{ 'ENV_VAR'|getenv('default_value') }}.
Examples
from jinja2 import Template, Environment
# We load the extension in a jinja2 Environment
env = Environment(extensions=["jinja2_getenv_extension.GetenvExtension"])
# For the example, we use a template from a simple string
template = env.from_string("the value of HOME environment variable is: "
"{{ 'HOME'|getenv }}")
result = template.render()
# [...]
Contributing guide
See CONTRIBUTING.md file.
Code of Conduct
See CODE_OF_CONDUCT.md file.
Sponsors
(If you are officially paid to work on MetWork Framework, please contact us to add your company logo here!)
Release files for jinja2-getenv-extension 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jinja2_getenv_extension-1.0.3.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jinja2_getenv_extension-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / jinja2_getenv_extension-1.0.3.tar.gz
| Download URL | jinja2_getenv_extension-1.0.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e26223f1e85203d889bd3607210e9db785bacce9493fc60db2dbdeb05f3b5a7
|
|
BLAKE2b-256 checksum How to use checksums |
32fe636df2b49329351466b1203a12b69fc94e06aa9028c064cd2f1a85ea0661
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / jinja2_getenv_extension-1.0.3-py3-none-any.whl
| Download URL | jinja2_getenv_extension-1.0.3-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3fbe24ba9c330de430c34b4bc36425bb7171e7d5016977ade4fc479d683aaa3
|
|
BLAKE2b-256 checksum How to use checksums |
345c38c9356e3955fbad403e86ce9c9d1e1159ffc4173b898f2e8f6b7a3829cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|