make the templates dir more reliable

pull/2041/head
dgtlmoon 4 months ago
parent e5edb914fd
commit a9346a6f09

@ -813,7 +813,9 @@ def changedetection_app(config=None, datastore_o=None):
# So that the extra panels can access _helpers.html etc, we set the environment to load from templates/
# And then render the code from the module
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates'))
import importlib.resources
templates_dir = str(importlib.resources.files("changedetectionio").joinpath('templates'))
env = Environment(loader=FileSystemLoader(templates_dir))
template = env.from_string(form.extra_form_content())
included_content = template.render(**template_args)

Loading…
Cancel
Save