diff options
| author | Yuval Adam <_@yuv.al> | 2017-10-10 16:05:26 +0300 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2017-10-10 16:05:26 +0300 |
| commit | f5738d71ef39eb665b51882eda5d4eb6739209cb (patch) | |
| tree | 2e1314d9139b6cf0a219d93c5c4f1d2e4efc0276 /geshem.py | |
| parent | f8da64516051c5607ad9d0dfe710c6870b142ee0 (diff) | |
Basic vue structure
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) |
