display version or env in footer

This commit is contained in:
Tobias Brunner 2025-10-03 15:34:12 +02:00
parent 26f39fec1e
commit 5cd80b7270
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ
2 changed files with 16 additions and 0 deletions

View file

@ -65,6 +65,8 @@
<div class="float-end">
<p>
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>
</div>
</div>

View 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