Commit 7eda707e authored by Zixian Cai's avatar Zixian Cai

Fix prefix

parent 43dff5a2
......@@ -29,7 +29,7 @@ WEB_POI_REPO = "mu-impl-fast"
WEB_POI_HOST = "angus"
WEB_RESULT_DIR = "../results"
WEB_SECRET = os.urandom(24)
WEB_APPLICATION_ROOT = ""
WEB_PREFIX = ""
WEB_HOST = "localhost"
WEB_PORT = 5000
WEB_DEBUG = False
......
......@@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from flask import Flask, render_template, request, flash, redirect, url_for
from flask import Flask, render_template, request, flash, redirect, url_for, \
Blueprint
from mubench.conf import settings
from mubench.frontend.utils import group_stats_result
from mubench.frontend.web import changes, timeline
......@@ -21,12 +22,13 @@ from mubench.frontend.web.storage import LocalStorage as storage
import click
import json
app = Flask(__name__)
app.config['SECRET_KEY'] = settings.WEB_SECRET
app.config['APPLICATION_ROOT'] = settings.WEB_APPLICATION_ROOT
root = Blueprint('root', __name__,
template_folder='templates',
static_folder="static",
url_prefix=settings.WEB_PREFIX)
@app.route("/visualize_file", methods=["POST"])
@root.route("/visualize_file", methods=["POST"])
def visualize_file():
if "logfile" not in request.files:
flash("No log file uploaded")
......@@ -37,12 +39,12 @@ def visualize_file():
return render_template("visualize.html", result=result)
@app.route("/tools")
@root.route("/tools")
def tools():
return render_template("tools.html")
@app.route("/")
@root.route("/")
def index():
repo, host = settings.WEB_POI_REPO, settings.WEB_POI_HOST
result = storage.load_relative(repo, host, 0)
......@@ -61,4 +63,7 @@ def index():
@click.option("--port", default=settings.WEB_PORT, type=int)
@click.option("--debug", default=settings.WEB_DEBUG, is_flag=True)
def web(host, port, debug):
app = Flask(__name__)
app.config['SECRET_KEY'] = settings.WEB_SECRET
app.register_blueprint(root)
app.run(host=host, port=port, debug=debug)
......@@ -24,7 +24,7 @@
<title>Mubench</title>
<link rel="shortcut icon"
href="{{ url_for('static', filename='favicon.ico') }}">
href="{{ url_for('root.static', filename='favicon.ico') }}">
<!-- Bootstrap -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
......@@ -43,12 +43,12 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="{{ url_for("index") }}">Mubench</a>
<a class="navbar-brand" href="{{ url_for("root.index") }}">Mubench</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="{{ url_for("tools") }}">Tools</a></li>
<li><a href="{{ url_for("root.tools") }}">Tools</a></li>
<li><a href="http://microvm.org">About</a></li>
</ul>
</div>
......
......@@ -19,7 +19,7 @@
<div class="panel panel-default">
<div class="panel-heading">Visualizing Log File</div>
<div class="panel-body">
<form action="{{ url_for('visualize_file') }}" method="post"
<form action="{{ url_for('root.visualize_file') }}" method="post"
enctype="multipart/form-data">
<div class="form-group">
<label for="file_1">Log File</label>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment