Some housekeeping
[redakcja.git] / src / redakcja / context_processors.py
1 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
3 #
4 def settings(request):
5     from django.conf import settings
6
7     if settings.SHOW_APP_VERSION:
8         import subprocess
9         process = subprocess.Popen(["git", "show", "--oneline"], stdout=subprocess.PIPE)
10         data, _err = process.communicate()
11         # get app version
12         VERSION = data.splitlines()[0].split()[0]
13     else:
14         VERSION = ''
15
16     return {
17         'MEDIA_URL': settings.MEDIA_URL,
18         'STATIC_URL': settings.STATIC_URL,
19         'APP_VERSION': VERSION,
20     }