display version or env in footer
This commit is contained in:
parent
26f39fec1e
commit
5cd80b7270
2 changed files with 16 additions and 0 deletions
|
|
@ -65,6 +65,8 @@
|
||||||
<div class="float-end">
|
<div class="float-end">
|
||||||
<p>
|
<p>
|
||||||
Crafted with <span class="text-danger"><i class="bi bi-heart-fill icon-mid"></i></span> in Zurich
|
Crafted with <span class="text-danger"><i class="bi bi-heart-fill icon-mid"></i></span> in Zurich
|
||||||
|
{% load version_tags %}
|
||||||
|
- {% get_version_or_env %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
14
src/servala/frontend/templatetags/version_tags.py
Normal file
14
src/servala/frontend/templatetags/version_tags.py
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import os
|
||||||
|
from django import template
|
||||||
|
from servala.__about__ import __version__
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag
|
||||||
|
def get_version_or_env():
|
||||||
|
"""Return version number in production, environment name otherwise."""
|
||||||
|
env = os.environ.get('SERVALA_ENVIRONMENT', 'development')
|
||||||
|
if env == 'production':
|
||||||
|
return __version__
|
||||||
|
return env
|
||||||
Loading…
Add table
Add a link
Reference in a new issue