diff options
Diffstat (limited to 'geshem.py')
| -rw-r--r-- | geshem.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -35,7 +35,6 @@ def fetch_latest_images(local=False): with open(str(STATIC_DIR / 'img' / filename), 'wb+') as f: f.write(image.content) -@app.route('/imgs') def get_imgs(): img_files = sorted( filter( @@ -50,11 +49,14 @@ def get_imgs(): } return imgs +@app.route('/imgs') +def imgs(): + return jsonify(get_imgs()) + @app.route('/') def home(): return render_template('index.html', imgs=get_imgs()) - @app.after_request def update_images(response): # poor man's background task @@ -67,5 +69,9 @@ def update_images(response): fetch_latest_images(local=True) return response +@app.context_processor +def inject_debug(): + return dict(debug=app.debug) + if __name__ == '__main__': app.run(host='0.0.0.0', debug=True) |
