From 83e6b7f0a5e1c746a0860620456e606894cc2c0a Mon Sep 17 00:00:00 2001 From: sg Date: Tue, 17 Jun 2025 00:21:01 +0300 Subject: [PATCH] updates --- classes.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/classes.py b/classes.py index 990f9b4..734ec83 100644 --- a/classes.py +++ b/classes.py @@ -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")