From caaa4304f09a3d446f0677ac7203ef429170e7e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Rekucki?= Date: Tue, 15 Jun 2010 12:04:30 +0200 Subject: [PATCH 1/1] Include a comment in app version on staging. --- redakcja/context_processors.py | 12 +++++++++++- redakcja/settings/common.py | 2 ++ redakcja/templates/base.html | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/redakcja/context_processors.py b/redakcja/context_processors.py index 813d8f36..5e3372ea 100644 --- a/redakcja/context_processors.py +++ b/redakcja/context_processors.py @@ -1,9 +1,19 @@ # -*- coding: utf-8 - def settings(request): from django.conf import settings + + if settings.SHOW_APP_VERSION: + import subprocess + process = subprocess.Popen(["git", "show", "--oneline"], stdout=subprocess.PIPE) + data, _err = process.communicate() + # get app version + VERSION = data.splitlines()[0].split()[0] + else: + VERSION = '' + return { 'MEDIA_URL': settings.MEDIA_URL, 'STATIC_URL': settings.STATIC_URL, + 'APP_VERSION': VERSION, } diff --git a/redakcja/settings/common.py b/redakcja/settings/common.py index a7fcf837..7b32ba63 100644 --- a/redakcja/settings/common.py +++ b/redakcja/settings/common.py @@ -138,6 +138,8 @@ WL_API_CONFIG = { "AUTH_PASSWD": "platforma", } +SHOW_APP_VERSION = False + try: from redakcja.settings.compress import * except ImportError: diff --git a/redakcja/templates/base.html b/redakcja/templates/base.html index 920311bd..749fd2a6 100644 --- a/redakcja/templates/base.html +++ b/redakcja/templates/base.html @@ -18,6 +18,7 @@
+
{% block maincontent %} {% endblock %}
-- 2.20.1