diff options
Diffstat (limited to 'docker/storperf-reporting/src/app.py')
-rw-r--r-- | docker/storperf-reporting/src/app.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/docker/storperf-reporting/src/app.py b/docker/storperf-reporting/src/app.py new file mode 100644 index 0000000..1c70faf --- /dev/null +++ b/docker/storperf-reporting/src/app.py @@ -0,0 +1,38 @@ +############################################################################## +# Copyright (c) 2017 Dell EMC and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +from flask import Flask, redirect, url_for, request, render_template, session +import urllib +import json +app = Flask(__name__) +app.secret_key = 'storperf_graphing_module' + + +@app.route('/success/') +def success(): + data = urllib.urlopen(session["url"]).read() + data = json.loads(data) + return render_template('plot_tables.html', data=data) + + +@app.route('/url', methods=['POST', 'GET']) +def url(): + if request.method == 'POST': + url = request.form['url'] + session["url"] = url + return redirect(url_for('success')) + + +@app.route('/') +def index(): + return render_template('index.html') + + +if __name__ == '__main__': + app.run(host="0.0.0.0", debug=True, threaded=True) |