Put that stuff in your settings.py Then you can use the git log last date to make that your "revision number" assuming you don't use regular version release numbers. With it you can do something like:
<div id="footer">
© My Company
— The Super App (revision {{ GIT_REVISION_DATE }})
</div>
See if you like it
1 2 3 4 5 6 7 8 | import subprocess
_proc = subprocess.Popen('git log --no-color -n 1 --date=iso',
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
try:
GIT_REVISION_DATE = [x.split('Date:')[1].split('+')[0].strip() for x in
_proc.communicate()[0].splitlines() if x.startswith('Date:')][0]
except IndexError:
GIT_REVISION_DATE = 'unknown'
|
More like this
- Form field with fixed value by roam 1 week, 5 days ago
- New Snippet! by Antoliny0919 2 weeks, 4 days ago
- Add Toggle Switch Widget to Django Forms by OgliariNatan 3 months, 1 week ago
- get_object_or_none by azwdevops 6 months, 4 weeks ago
- Mask sensitive data from logger by agusmakmun 8 months, 3 weeks ago
Comments
Is it only for Linux machines? Thanks...
#
Nice and simple idea. Since I prefer mercurial a slight modification will be needed though.
Thanks.
#
Please login first before commenting.