✨ display app version
This commit is contained in:
parent
0e2e80529c
commit
244c9f376e
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,3 +2,8 @@
|
|||
width: 90%;
|
||||
margin: 3em auto;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
margin: 2em auto;
|
||||
}
|
||||
|
|
@ -10,5 +10,8 @@
|
|||
<div class="container">
|
||||
{{ content | safe }}
|
||||
</div>
|
||||
<div class="container footer">
|
||||
Version: {{ version }}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
1.0.1
|
||||
Loading…
Reference in New Issue