1
0
Fork 0
mirror of https://github.com/Findus23/acronomy.git synced 2024-09-19 15:33:45 +02:00

fix git hash

This commit is contained in:
Lukas Winkler 2023-04-12 22:12:27 +02:00
parent fa57c93f4b
commit d7a8bb6d33
Signed by: lukas
GPG key ID: 54DE4D798D244853
3 changed files with 11 additions and 1 deletions

View file

@ -0,0 +1,7 @@
from django.core.cache import cache
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **kwargs):
cache.clear()

View file

@ -1,3 +1,4 @@
from pathlib import Path
from subprocess import run from subprocess import run
from django import template from django import template
@ -8,9 +9,10 @@ register = template.Library()
@register.simple_tag @register.simple_tag
def commit_id(): def commit_id():
current_dir = Path(__file__).parent
commit = cache.get("commit") commit = cache.get("commit")
if not commit: if not commit:
sp = run(["git", "rev-parse", "--verify", "HEAD"], capture_output=True) sp = run(["git", "rev-parse", "--verify", "HEAD"], capture_output=True, cwd=current_dir)
commit = sp.stdout.decode().strip() commit = sp.stdout.decode().strip()
cache.set("commit", commit) cache.set("commit", commit)
return commit return commit

View file

@ -11,5 +11,6 @@ git pull
$manage scss $manage scss
$manage collectstatic --noinput $manage collectstatic --noinput
$manage migrate $manage migrate
$manage clearcache
sudo systemctl reload acronomy.service sudo systemctl reload acronomy.service