Fixing URL for static files 97/38097/3
authorsaksham115 <saksham.agrawal@research.iiit.ac.in>
Tue, 25 Jul 2017 17:39:16 +0000 (23:09 +0530)
committerSaksham Agrawal <saksham.agrawal@research.iiit.ac.in>
Tue, 25 Jul 2017 18:07:08 +0000 (18:07 +0000)
Earlier the static files were being served on /static/ now it has been fixed and are being served on /reporting/js/ and /reporting/css/ for js and css files respectively.
JIRA: STORPERF-192

Change-Id: Ibcce2210de88f2359d011752513fdab9f930ab5b
Signed-off-by: saksham115 <saksham.agrawal@research.iiit.ac.in>
docker/storperf-reporting/src/app.py
docker/storperf-reporting/src/templates/index.html
docker/storperf-reporting/src/templates/plot_tables.html

index 25edf48..fadda66 100644 (file)
@@ -8,6 +8,7 @@
 ##############################################################################
 
 from flask import Flask, redirect, url_for, request, render_template, session
+from flask import send_from_directory
 import urllib
 import json
 app = Flask(__name__)
@@ -29,6 +30,16 @@ def url():
         return redirect(url_for('success'))
 
 
+@app.route('/reporting/js/<path:path>')
+def js(path):
+    return send_from_directory('static/js/', path)
+
+
+@app.route('/reporting/css/<path:path>')
+def css(path):
+    return send_from_directory('static/css/', path)
+
+
 @app.route('/reporting/')
 def index():
     return render_template('index.html')
index c302299..70e33bd 100644 (file)
@@ -3,10 +3,10 @@
 
 <head>
     <title>Graphing Module | Storperf</title>
-    <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
-    <script src="{{ url_for('static', filename='js/jquery-2.1.3.min.js') }}"></script>
-    <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
-    <script src="{{ url_for('static', filename='js/jquery.bootpag.min.js') }}"></script>
+    <link rel="stylesheet" href="/reporting/css/bootstrap.min.css">
+    <script src="/reporting/js/jquery-2.1.3.min.js"></script>
+    <script src="/reporting/js/bootstrap.min.js"></script>
+    <script src="/reporting/js/jquery.bootpag.min.js"></script>
 </head>
 
 <body>
index 4d6c887..a8c508d 100644 (file)
@@ -4,12 +4,12 @@
 <head>
     <meta charset="utf-8" />
     <title>Chart | Storperf</title>
-    <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
-    <script src="{{ url_for('static', filename='js/jquery-2.1.3.min.js') }}"></script>
-    <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
-    <script src="{{ url_for('static', filename='js/jquery.bootpag.min.js') }}"></script>
-    <script src="{{ url_for('static', filename='js/plotly-latest.min.js') }}"></script>
-    <script src="{{ url_for('static', filename='js/Chart.min.js') }}"></script>
+    <link rel="stylesheet" href="/reporting/css/bootstrap.min.css">
+    <script src="/reporting/js/jquery-2.1.3.min.js"></script>
+    <script src="/reporting/js/bootstrap.min.js"></script>
+    <script src="/reporting/js/jquery.bootpag.min.js"></script>
+    <script src="/reporting/js/plotly-latest.min.js"></script>
+    <script src="/reporting/js/Chart.min.js"></script>
     <style>
         .table td {
             text-align: left;