From f5738d71ef39eb665b51882eda5d4eb6739209cb Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Tue, 10 Oct 2017 16:05:26 +0300 Subject: Basic vue structure --- geshem.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'geshem.py') diff --git a/geshem.py b/geshem.py index b06b8e9..b192e08 100644 --- a/geshem.py +++ b/geshem.py @@ -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) -- cgit v1.3.1