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")