mirror of
https://github.com/Findus23/acronomy.git
synced 2024-09-18 14:33:43 +02:00
fix git hash
This commit is contained in:
parent
fa57c93f4b
commit
d7a8bb6d33
3 changed files with 11 additions and 1 deletions
7
acros/management/commands/clearcache.py
Normal file
7
acros/management/commands/clearcache.py
Normal 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()
|
|
@ -1,3 +1,4 @@
|
|||
from pathlib import Path
|
||||
from subprocess import run
|
||||
|
||||
from django import template
|
||||
|
@ -8,9 +9,10 @@ register = template.Library()
|
|||
|
||||
@register.simple_tag
|
||||
def commit_id():
|
||||
current_dir = Path(__file__).parent
|
||||
commit = cache.get("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()
|
||||
cache.set("commit", commit)
|
||||
return commit
|
||||
|
|
|
@ -11,5 +11,6 @@ git pull
|
|||
$manage scss
|
||||
$manage collectstatic --noinput
|
||||
$manage migrate
|
||||
$manage clearcache
|
||||
|
||||
sudo systemctl reload acronomy.service
|
||||
|
|
Loading…
Reference in a new issue