Disable caching and graph
This commit is contained in:
parent
d0abc616bf
commit
ee439c9e0e
|
@ -6,13 +6,11 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load cache %}
|
{% load cache %}
|
||||||
|
|
||||||
{% cache 3600 script %}
|
|
||||||
<link rel="shortcut icon" href="{% static 'favicon.ico' %}">
|
<link rel="shortcut icon" href="{% static 'favicon.ico' %}">
|
||||||
{% load compress %}
|
{% load compress %}
|
||||||
{% compress css %}
|
{% compress css %}
|
||||||
<link type="text/x-scss" href="{% static 'theme.scss' %}" rel="stylesheet" media="screen">
|
<link type="text/x-scss" href="{% static 'theme.scss' %}" rel="stylesheet" media="screen">
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
{% endcache %}
|
|
||||||
|
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -21,7 +19,6 @@
|
||||||
<title>{% block title %}Title{% endblock %}</title>
|
<title>{% block title %}Title{% endblock %}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% cache 3600 navbar %}
|
|
||||||
<nav class="navbar navbar-expand-md navbar-dark bg-secondary mb-2">
|
<nav class="navbar navbar-expand-md navbar-dark bg-secondary mb-2">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" href="/">Home</a>
|
<a class="navbar-brand" href="/">Home</a>
|
||||||
|
@ -55,7 +52,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
{% endcache %}
|
|
||||||
|
|
||||||
{% block body %}{% endblock %}
|
{% block body %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
{% cache 60 repos %}
|
|
||||||
{% if repo_list %}
|
{% if repo_list %}
|
||||||
<div class="grid mx-auto d-flex justify-content-center flex-wrap">
|
<div class="grid mx-auto d-flex justify-content-center flex-wrap">
|
||||||
{% for repo in repo_list %}
|
{% for repo in repo_list %}
|
||||||
|
@ -83,6 +82,5 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endcache %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from django.views.decorators.cache import cache_page
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', cache_page(10)(views.index), name='index'),
|
path('', views.index, name='index'),
|
||||||
path('post/repo', views.post_repo, name='repo'),
|
path('post/repo', views.post_repo, name='repo'),
|
||||||
path('post/archive', views.post_archive, name='archive'),
|
path('post/archive', views.post_archive, name='archive'),
|
||||||
path('post/error', views.post_error, name='error'),
|
path('post/error', views.post_error, name='error'),
|
||||||
|
|
|
@ -7,17 +7,18 @@ from .forms import RepoForm, ArchiveForm, ErrorForm, LocationForm
|
||||||
from django.contrib.auth.decorators import permission_required
|
from django.contrib.auth.decorators import permission_required
|
||||||
from .utility import data
|
from .utility import data
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from django.core.cache import cache
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
repo_list = Repo.objects.all()
|
repo_list = Repo.objects.all()
|
||||||
location_list = Location.objects.all()
|
location_list = Location.objects.all()
|
||||||
|
|
||||||
repo_dict = repo_daily_dict(repo_list, 24)
|
# repo_dict = repo_daily_dict(repo_list, 24)
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'repo_list': repo_list,
|
'repo_list': repo_list,
|
||||||
'hour_list': repo_dict,
|
# 'hour_list': repo_dict,
|
||||||
'location_list': location_list,
|
'location_list': location_list,
|
||||||
}
|
}
|
||||||
return render(request, 'borg/index.html', context)
|
return render(request, 'borg/index.html', context)
|
||||||
|
@ -57,6 +58,7 @@ def post_repo(request):
|
||||||
'last_modified': cdata['last_modified'],
|
'last_modified': cdata['last_modified'],
|
||||||
'label': label})
|
'label': label})
|
||||||
repo.save()
|
repo.save()
|
||||||
|
cache.clear()
|
||||||
|
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
else:
|
else:
|
||||||
|
@ -85,6 +87,7 @@ def post_archive(request):
|
||||||
|
|
||||||
archive = Archive(**archive_dict, repo=repo, cache=cache)
|
archive = Archive(**archive_dict, repo=repo, cache=cache)
|
||||||
archive.save()
|
archive.save()
|
||||||
|
cache.clear()
|
||||||
|
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
else:
|
else:
|
||||||
|
@ -103,6 +106,7 @@ def post_error(request):
|
||||||
|
|
||||||
error = Error(label=label, error=cdata['error'], time=cdata['time'])
|
error = Error(label=label, error=cdata['error'], time=cdata['time'])
|
||||||
error.save()
|
error.save()
|
||||||
|
cache.clear()
|
||||||
|
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
else:
|
else:
|
||||||
|
@ -120,6 +124,7 @@ def post_location(request):
|
||||||
label, _ = Location.objects.get_or_create(label=cdata['label'],
|
label, _ = Location.objects.get_or_create(label=cdata['label'],
|
||||||
defaults={"path": cdata["path"]})
|
defaults={"path": cdata["path"]})
|
||||||
label.save()
|
label.save()
|
||||||
|
cache.clear()
|
||||||
|
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user