This commit is contained in:
SG
2025-06-17 13:46:14 +03:00

View File

@@ -24,7 +24,15 @@ else:
base_dir = Path(__file__).resolve().parent base_dir = Path(__file__).resolve().parent
# Prepare template rendering engine # Prepare template rendering engine
jinja_env_dir = f"{base_dir}/themes/{Config.THEME}/templates" if Path(f"themes/{Config.THEME}/templates").exists():
# Use the templates from the initialized site instance and the installed theme
jinja_env_dir = f"themes/{Config.THEME}/templates"
print("USING LOCALLY INITIALIZED THEMES")
else:
# Use default templates from the default theme shipped with the app
# i.e. PyInstaller-packed single executable
print("USING DEFAULT THEMES")
jinja_env_dir = f"{base_dir}/themes/default/templates"
env = Environment(loader=FileSystemLoader(f"{jinja_env_dir}")) env = Environment(loader=FileSystemLoader(f"{jinja_env_dir}"))
env.globals['header_image'] = f"{base_dir}/themes/{Config.THEME}/static/images/header.jpg" env.globals['header_image'] = f"{base_dir}/themes/{Config.THEME}/static/images/header.jpg"
index_template = env.get_template("index.html") index_template = env.get_template("index.html")