From: Olivier Tétard Date: Sat, 14 Nov 2015 10:12:59 +0000 (+0100) Subject: Affichage du json associé au Ogg X-Git-Url: http://olivier.miskin.fr/git/?a=commitdiff_plain;h=fe576c2c6600d6e1e279bc92989772b740049df1;p=femtoblackweb.git Affichage du json associé au Ogg --- diff --git a/femtoblackweb.py b/femtoblackweb.py index aab1433..8a52864 100644 --- a/femtoblackweb.py +++ b/femtoblackweb.py @@ -12,6 +12,7 @@ from flask.ext.socketio import SocketIO, emit, join_room, leave_room, close_room from flask_bootstrap import Bootstrap +import json # configuration @@ -100,9 +101,12 @@ def download(filename): @app.route('/analyze/') def analyze_file(filename): f = os.path.join(app.config['UPLOAD_FOLDER'], filename) + json_file = os.path.join(app.config['UPLOAD_FOLDER'], "{}.json".format(filename)) - if os.path.exists(f): - return render_template('analyze_file.html', filename=filename) + if os.path.exists(f) and os.path.isfile(json_file): + with open(json_file) as json_f: + json_content = json.load(json_f) + return render_template('analyze_file.html', filename=filename, json=json_content) else: abort(404) diff --git a/templates/analyze_file.html b/templates/analyze_file.html index 3be3538..d28ac7b 100644 --- a/templates/analyze_file.html +++ b/templates/analyze_file.html @@ -10,7 +10,7 @@ - +
- + +
+    {{ json }}
+  
{% endblock %} {% block scripts %}