Illustrations/web/core/context_processors.py

10 lines
310 B
Python

from pathlib import Path
def app_version(request):
version_file = Path(__file__).resolve().parent.parent / "/version.txt"
try:
with open(version_file, "r") as f:
version = f.read().strip()
except FileNotFoundError:
version = "v0.0.0"
return {"APP_VERSION": version}