This commit is contained in:
sg
2025-06-17 00:21:01 +03:00
parent 0583eb07ee
commit 83e6b7f0a5

View File

@@ -21,7 +21,15 @@ else:
base_dir = Path(__file__).resolve().parent
# 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.globals['header_image'] = f"{base_dir}/themes/{Config.THEME}/static/images/header.jpg"
index_template = env.get_template("index.html")