display app version

This commit is contained in:
Marc Koch 2025-04-25 16:39:10 +02:00
parent 0e2e80529c
commit 244c9f376e
Signed by: marc
GPG Key ID: 12406554CFB028B9
5 changed files with 19 additions and 0 deletions

View File

@ -9,6 +9,7 @@ WORKDIR /app
COPY src/ ./ COPY src/ ./
COPY requirements.txt . COPY requirements.txt .
COPY README.md index.md COPY README.md index.md
COPY version.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt

View File

@ -236,6 +236,14 @@ def get_markdown():
md = markdown.Markdown(extensions=["fenced_code"]) md = markdown.Markdown(extensions=["fenced_code"])
return md.convert(f.read()) 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") @api.get("/info")
def info(request): def info(request):
@ -277,4 +285,5 @@ app.route("api/", include=api.urls)
def home(request): def home(request):
return render(request, "index.html", { return render(request, "index.html", {
"content": get_markdown(), "content": get_markdown(),
"version": get_version(),
}) })

View File

@ -1,4 +1,9 @@
.container { .container {
width: 90%; width: 90%;
margin: 3em auto; margin: 3em auto;
}
.footer {
text-align: center;
margin: 2em auto;
} }

View File

@ -10,5 +10,8 @@
<div class="container"> <div class="container">
{{ content | safe }} {{ content | safe }}
</div> </div>
<div class="container footer">
Version: {{ version }}
</div>
</body> </body>
</html> </html>

1
version.txt Normal file
View File

@ -0,0 +1 @@
1.0.1