from flask_bootstrap import Bootstrap
+import json
# configuration
@app.route('/analyze/<filename>')
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)