aboutsummaryrefslogtreecommitdiff
path: root/jb/settings.py
diff options
context:
space:
mode:
authorstuppie2026-09-17 10:05:48 -0600
committerstuppie2026-09-17 10:05:48 -0600
commite73cab566ca6f40c213c9a42d34d8f6af8515589 (patch)
tree01ad453e75f8114c59708984ed53cbf066f6e365 /jb/settings.py
parentbb999c73ab563b27e469fc4f74a5f81a5f35fffd (diff)
downloadamt-jb-e73cab566ca6f40c213c9a42d34d8f6af8515589.tar.gz
amt-jb-e73cab566ca6f40c213c9a42d34d8f6af8515589.zip
render_base_html to server base html with js file templated
Diffstat (limited to 'jb/settings.py')
-rw-r--r--jb/settings.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/jb/settings.py b/jb/settings.py
index 1bf65bc..779bd85 100644
--- a/jb/settings.py
+++ b/jb/settings.py
@@ -2,7 +2,6 @@ import json
from functools import lru_cache
from os.path import abspath
from os.path import dirname as pdirname
-from os.path import join as pjoin
from pathlib import Path
from generalresearch.config import GRLBaseSettings, is_debug
@@ -16,7 +15,6 @@ from pydantic_settings import SettingsConfigDict
BASE_DIR = pdirname(pdirname(abspath(__file__)))
BASE_HTML_PATH = Path(BASE_DIR) / "templates" / "base.html"
-BASE_HTML = BASE_HTML_PATH.read_text()
MANIFEST_PATH = Path(BASE_DIR) / "jb-ui" / "dist/.vite/manifest.json"
@@ -25,8 +23,16 @@ def load_manifest():
return json.load(f)
-class Settings(GRLBaseSettings):
+def render_base_html() -> str:
+ manifest = load_manifest()
+ return (
+ BASE_HTML_PATH.read_text()
+ .replace("{{ css_file }}", manifest["style.css"]["file"])
+ .replace("{{ js_file }}", manifest["src/main.tsx"]["file"])
+ )
+
+class Settings(GRLBaseSettings):
model_config = SettingsConfigDict(
env_file=(".env.test", ".env.testing", ".env.staging", ".env.prod"),
env_file_encoding="utf-8",