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