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)
|
||||
|
||||
def dated_url_for(endpoint, **values):
|
||||
if endpoint == 'static':
|
||||
filename = values.get('filename', None)
|
||||
if filename:
|
||||
if endpoint == "static":
|
||||
filename = values.get("filename", None)
|
||||
if filename and not filename.startswith("const/"):
|
||||
file_path = os.path.join(glob.app.root_path,
|
||||
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)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<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 %}
|
||||
<title>Husstanden - {{ title }}</title>
|
||||
|
@ -13,8 +13,8 @@
|
|||
</head>
|
||||
<body>
|
||||
{% block content %}{% endblock %}
|
||||
<script src="{{ url_for('static', filename='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='js/bootstrap.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='const/js/popper.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='const/js/bootstrap.min.js') }}"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user