True static items will be in const (due to anti-cache workaround)
This commit is contained in:
parent
409ed7b5a2
commit
15cab52d54
8
main.py
8
main.py
|
@ -17,12 +17,12 @@ if glob.config["disable-static-cache"]:
|
||||||
return dict(url_for=dated_url_for)
|
return dict(url_for=dated_url_for)
|
||||||
|
|
||||||
def dated_url_for(endpoint, **values):
|
def dated_url_for(endpoint, **values):
|
||||||
if endpoint == 'static':
|
if endpoint == "static":
|
||||||
filename = values.get('filename', None)
|
filename = values.get("filename", None)
|
||||||
if filename:
|
if filename and not filename.startswith("const/"):
|
||||||
file_path = os.path.join(glob.app.root_path,
|
file_path = os.path.join(glob.app.root_path,
|
||||||
endpoint, filename)
|
endpoint, filename)
|
||||||
values['q'] = int(os.stat(file_path).st_mtime)
|
values["q"] = int(os.stat(file_path).st_mtime)
|
||||||
return url_for(endpoint, **values)
|
return url_for(endpoint, **values)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
|
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='const/css/bootstrap.min.css') }}">
|
||||||
|
|
||||||
{% if title %}
|
{% if title %}
|
||||||
<title>Husstanden - {{ title }}</title>
|
<title>Husstanden - {{ title }}</title>
|
||||||
|
@ -13,8 +13,8 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
<script src="{{ url_for('static', filename='js/jquery-3.3.1.slim.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='const/js/jquery-3.3.1.slim.min.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/popper.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='const/js/popper.min.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='const/js/bootstrap.min.js') }}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user