Merge branch 'themes' of https://git.exocortex.ru/Exocortex/hydrogen into themes
This commit is contained in:
10
classes.py
10
classes.py
@@ -24,7 +24,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")
|
||||
|
||||
Reference in New Issue
Block a user