mirror of
https://git.nolog.cz/NoLog.cz/nginx-configurator.git
synced 2025-01-31 03:43:35 +01:00
15 lines
416 B
Python
15 lines
416 B
Python
import pkgutil
|
|
from jinja2 import Environment, FunctionLoader, select_autoescape
|
|
|
|
|
|
def load_template(name):
|
|
"""
|
|
Loads file from the templates folder and returns file contents as a string.
|
|
See jinja2.FunctionLoader docs.
|
|
"""
|
|
return pkgutil.get_data(f"{__package__}.templates", name).decode("utf-8")
|
|
|
|
|
|
jinja = Environment(
|
|
loader=FunctionLoader(load_template), autoescape=select_autoescape()
|
|
)
|