- forcing browser to refresh images via timestamp

This commit is contained in:
Ulrich Knechtelsdorfer
2016-11-28 00:17:35 +01:00
parent 8ae2683d71
commit a96342c815
5 changed files with 10 additions and 5 deletions

View File

@@ -18,7 +18,7 @@
<div class="center"> <div class="center">
<h2>{{product.name}}</h2> <h2>{{product.name}}</h2>
{% set fils = "product_%s.png" % product.name %} {% set fils = "product_%s.png" % product.name %}
<img src="{{ url_for('static', filename=fils) }}" /><br> <img src="{{ url_for('static', filename=fils) }}?{{timestamp}}" /><br>
</div> </div>
<div class="right"> <div class="right">
{{"%0.2f" % product.price}} € {{"%0.2f" % product.price}} €

View File

@@ -15,7 +15,7 @@
<div class="fridge_sensor"> <div class="fridge_sensor">
{{ sensor.name }}<br> {{ sensor.name }}<br>
{% set fils = "log_%s.png" % sensor.id %} {% set fils = "log_%s.png" % sensor.id %}
<img src="{{ url_for('static', filename=fils) }}" /><br> <img src="{{ url_for('static', filename=fils) }}?{{timestamp}}" /><br>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@@ -2,7 +2,7 @@
{% set title = "Bierliste" %} {% set title = "Bierliste" %}
{% block content %} {% block content %}
<h1> Bierliste </h1> <h1> Bierliste </h1>
<img src="{{ url_for('static', filename='bierliste_small.png') }}" style="width:100%;max-width:990px;"> <img src="{{ url_for('static', filename='bierliste_small.png') }}?{{timestamp}}" style="width:100%;max-width:990px;">
<!-- <table> <!-- <table>
<tr> <tr>
<th>ID</th> <th>ID</th>

View File

@@ -4,10 +4,10 @@
<h1> Statistik </h1> <h1> Statistik </h1>
<div> <div>
<h2> Bierkonsum </h2> <h2> Bierkonsum </h2>
<img src="{{ url_for('static', filename='total.png') }}"> <img src="{{ url_for('static', filename='total.png') }}?{{timestamp}}">
{% if user %} {% if user %}
{% set fils = "total%03d.png" % user.id %} {% set fils = "total%03d.png" % user.id %}
<img src="{{ url_for('static', filename=fils) }}"> <img src="{{ url_for('static', filename=fils) }}?{{timestamp}}">
{% endif %} {% endif %}
</div> </div>
<h1> Abrechnung </h1> <h1> Abrechnung </h1>

View File

@@ -13,7 +13,12 @@ from consumption import Consumption
import bcrypt import bcrypt
import os import os
from settings import * from settings import *
import time
# makes the variable timehex available in all templates
@app.context_processor
def inject_time():
return dict(timestamp=time.time().__int__())
@app.route('/static/<path:path>') @app.route('/static/<path:path>')
def static_proxy(path): def static_proxy(path):