Exemplo n.º 1
0
def serve_dashboard_json():
    shortlink = request.args.get("id")
    dashboard = Dashboard.query.get(shortlink)
    return flask.jsonify(content=json.loads(dashboard.json), shortlink=shortlink)


@app.route("/ua-<shortlink>", methods=["GET"])
def serve_unauthenticated_dashboard(shortlink):
    return render_template("base.html", mode="view")


@app.route("/<shortlink>", methods=["GET"])
@auth.login_required
def serve_authenticated_dashboard(shortlink):
    return render_template("base.html", mode="view")


@app.after_request
def add_header(response):
    """
    Add headers to both force latest IE rendering engine or Chrome Frame,
    and also to cache the rendered page for 10 minutes.
    """
    response.headers["X-UA-Compatible"] = "IE=Edge,chrome=1"
    response.headers["Cache-Control"] = "public, max-age=0"
    return response


if __name__ == "__main__":
    app.run(debug=True, port=8080)
Exemplo n.º 2
0
@app.route('/ua-<shortlink>', methods=['GET'])
def serve_unauthenticated_dashboard(shortlink):
    return render_template(
        'base.html',
        mode='view',
        CONFIG={'PLOTLY_DOMAIN': app.config['PLOTLY_DOMAIN']})


@app.route('/<shortlink>', methods=['GET'])
@auth.login_required
def serve_authenticated_dashboard(shortlink):
    return render_template(
        'base.html',
        mode='view',
        CONFIG={'PLOTLY_DOMAIN': app.config['PLOTLY_DOMAIN']})


@app.after_request
def add_header(response):
    """
    Add headers to both force latest IE rendering engine or Chrome Frame,
    and also to cache the rendered page for 10 minutes.
    """
    response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
    response.headers['Cache-Control'] = 'public, max-age=0'
    return response


if __name__ == '__main__':
    app.run(debug=True, port=8080)
Exemplo n.º 3
0
from dashboardsly import app

if __name__ == "__main__":
    app.run(debug=app.config["DEBUG"], port=8080)