moved static files into themes
This commit is contained in:
10
jinja_env.py
10
jinja_env.py
@@ -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")
|
||||
Reference in New Issue
Block a user