19 lines
513 B
Python
19 lines
513 B
Python
from fastapi.templating import Jinja2Templates
|
|
|
|
from db import get_db_conn
|
|
|
|
|
|
def _develop_mode() -> bool:
|
|
try:
|
|
with get_db_conn() as conn:
|
|
with conn.cursor() as cur:
|
|
cur.execute("SELECT develop_mode FROM app_settings WHERE id = 1")
|
|
row = cur.fetchone()
|
|
return bool(row[0]) if row else False
|
|
except Exception:
|
|
return False
|
|
|
|
|
|
templates = Jinja2Templates(directory="templates")
|
|
templates.env.globals["develop_mode"] = _develop_mode
|