Add a mechanism for cache-busting static files
This commit is contained in:
1 parent
5692a1373a
commit
eca8ccc613
7 files changed
+16
-12
No files matched your search
@@ -25,6 +25,8 @@ import traceback
|
||||
|
||||
from OpenSite.settings import PROJECT_PATH
|
||||
|
||||
OPENBENCH_STATIC_VERSION = 'v1'
|
||||
|
||||
OPENBENCH_CONFIG = None # Initialized by OpenBench/apps.py
|
||||
|
||||
def create_openbench_config():
|
||||
|
||||
+2
-1
@@ -33,7 +33,7 @@ from OpenBench.workloads.modify_workload import modify_workload
|
||||
from OpenBench.workloads.verify_workload import verify_workload
|
||||
from OpenBench.workloads.view_workload import view_workload
|
||||
|
||||
from OpenBench.config import OPENBENCH_CONFIG
|
||||
from OpenBench.config import OPENBENCH_CONFIG, OPENBENCH_STATIC_VERSION
|
||||
from OpenSite.settings import PROJECT_PATH
|
||||
|
||||
from OpenBench.models import *
|
||||
@@ -68,6 +68,7 @@ def render(request, template, content={}, always_allow=False, error=None, warnin
|
||||
|
||||
data = content.copy()
|
||||
data.update({ 'config' : OPENBENCH_CONFIG })
|
||||
data.update({ 'static_version' : OPENBENCH_STATIC_VERSION })
|
||||
|
||||
if OPENBENCH_CONFIG['require_login_to_view']:
|
||||
if not request.user.is_authenticated and not always_allow:
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="icon" type="image/svg+xml" href="{% static 'logo.svg' %}">
|
||||
<link rel="stylesheet" href="{% static 'style.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'base.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'form.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'paging.css' %}">
|
||||
<link rel="icon" type="image/svg+xml" href="{% static 'logo.svg' %}?{{ static_version }}">
|
||||
<link rel="stylesheet" href="{% static 'style.css' %}?{{ static_version }}">
|
||||
<link rel="stylesheet" href="{% static 'base.css' %}?{{ static_version }}">
|
||||
<link rel="stylesheet" href="{% static 'form.css' %}?{{ static_version }}">
|
||||
<link rel="stylesheet" href="{% static 'paging.css' %}?{{ static_version }}">
|
||||
|
||||
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css' rel='stylesheet'>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
{% load static %}
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="{% static 'ethereal.css' %}">
|
||||
<link rel="icon" type="image/svg+xml" href="{% static 'logo.svg' %}">
|
||||
<link rel="stylesheet" href="{% static 'ethereal.css' %}?{{ static_version }}">
|
||||
<link rel="icon" type="image/svg+xml" href="{% static 'logo.svg' %}?{{ static_version }}">
|
||||
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital@0;1&display=swap" rel="stylesheet">
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
{{ networks|json_script:"json-networks" }}
|
||||
{{ profile.repos|json_script:"json-repos" }}
|
||||
|
||||
<script src="{% static 'create_workload.js' %}"></script>
|
||||
<script src="{% static 'default_text.js' %}"></script>
|
||||
<script src="{% static 'create_workload.js' %}?{{ static_version }}"></script>
|
||||
<script src="{% static 'default_text.js' %}?{{ static_version }}"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener(
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
{{ networks|json_script:"json-networks" }}
|
||||
|
||||
<script src="{% static 'networks.js' %}"></script>
|
||||
<script src="{% static 'networks.js' %}?{{ static_version }}"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener(
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{% load static %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="{% static 'copy_text.js' %}"></script>
|
||||
<script src="{% static 'copy_text.js' %}?{{ static_version }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
Reference in new issue
Block a user