moved static files into themes

This commit is contained in:
SG
2025-06-14 18:14:24 +03:00
parent ed9d1dade2
commit 793388d4ba
13 changed files with 32 additions and 206 deletions

View File

@@ -3,15 +3,17 @@ from pathlib import Path
from jinja2 import Environment, FileSystemLoader
from config import Config
# Prepare template rendering engine
# get the scrip directory
if getattr(sys, 'frozen', False):
# Running fron Pyinstaller-packed binary
base_dir = Path(sys._MEIPASS)
else:
# Running as a plain Python app
base_dir = Path(__file__).resolve().parent
env = Environment(loader=FileSystemLoader(f"{base_dir}/{Config.TEMPLATES_DIR}"))
env.globals['header_image'] = Config.HEADER_IMAGE
# Prepare template rendering engine
jinja_env_dir = f"{base_dir}/themes/{Config.THEME}/templates"
env = Environment(loader=FileSystemLoader(f"{jinja_env_dir}"))
env.globals['header_image'] = f"{base_dir}/static/header.jpg"
index_template = env.get_template("index.html")
content_item_template = env.get_template("content_item.html")