From 244c9f376ec751922cad7e8c671f11f90b234e01 Mon Sep 17 00:00:00 2001 From: Marc Koch Date: Fri, 25 Apr 2025 16:39:10 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20display=20app=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 + src/booking.py | 9 +++++++++ src/static/style.css | 5 +++++ src/templates/index.html | 3 +++ version.txt | 1 + 5 files changed, 19 insertions(+) create mode 100644 version.txt diff --git a/Dockerfile b/Dockerfile index b12bb88..ddec37e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ WORKDIR /app COPY src/ ./ COPY requirements.txt . COPY README.md index.md +COPY version.txt . RUN pip install --no-cache-dir -r requirements.txt diff --git a/src/booking.py b/src/booking.py index e0a367a..0c9ff76 100644 --- a/src/booking.py +++ b/src/booking.py @@ -236,6 +236,14 @@ def get_markdown(): md = markdown.Markdown(extensions=["fenced_code"]) return md.convert(f.read()) +def get_version(): + """ + Get the version of the app from the version.txt file. + :return: + """ + with open(BASE_DIR / "version.txt") as f: + return f.read().strip() + @api.get("/info") def info(request): @@ -277,4 +285,5 @@ app.route("api/", include=api.urls) def home(request): return render(request, "index.html", { "content": get_markdown(), + "version": get_version(), }) diff --git a/src/static/style.css b/src/static/style.css index 2e982f9..238bd48 100644 --- a/src/static/style.css +++ b/src/static/style.css @@ -1,4 +1,9 @@ .container { width: 90%; margin: 3em auto; +} + +.footer { + text-align: center; + margin: 2em auto; } \ No newline at end of file diff --git a/src/templates/index.html b/src/templates/index.html index 470f2ee..527fa8f 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -10,5 +10,8 @@
{{ content | safe }}
+ \ No newline at end of file diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..7f20734 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +1.0.1 \ No newline at end of file