From 5ffcd6d9bb07a1ce37740dbdf501d68966467ee9 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Wed, 5 Jan 2022 20:35:09 +0100 Subject: get version, commit_id and branch only at startup --- manager/settings.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'manager') diff --git a/manager/settings.py b/manager/settings.py index 904600b..7649631 100644 --- a/manager/settings.py +++ b/manager/settings.py @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os +from subprocess import check_output # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -44,6 +45,12 @@ EMAIL_USE_TLS = True DEFAULT_FROM_EMAIL = 'mafaldo@hotmail.it' SERVER_EMAIL = 'mafaldo@hotmail.it' +VERSION = "" +with open("version.txt", 'r') as f: + VERSION = f.read() + +BRANCH = check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).decode() +COMMIT_ID = check_output(["git", "rev-parse", "HEAD"]).decode() # Application definition -- cgit v1.2.1