import script
[redakcja.git] / redakcja / context_processors.py
1 # -*- coding: utf-8
2
3 def settings(request):
4     from django.conf import settings
5
6     if settings.SHOW_APP_VERSION:
7         import subprocess
8         process = subprocess.Popen(["git", "show", "--oneline"], stdout=subprocess.PIPE)
9         data, _err = process.communicate()
10         # get app version 
11         VERSION = data.splitlines()[0].split()[0]
12     else:
13         VERSION = ''
14
15     return {
16         'MEDIA_URL': settings.MEDIA_URL,
17         'STATIC_URL': settings.STATIC_URL,
18         'APP_VERSION': VERSION,
19     }