File size: 957 Bytes
1026840
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from flask import Flask, render_template, jsonify
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from werkzeug.serving import run_simple

app = Flask(__name__)
app.secret_key = "change-this-secret-key"   # CHANGE THIS - it is public via the bridge
app.config["APPLICATION_ROOT"] = "/app"     # matches the public path below

# ----- Your routes, templates, sessions, login logic stay EXACTLY as they are -----

@app.route("/")
def index():
    return render_template("index.html")

@app.route("/status")
def status():
    return jsonify({"status": "running", "app": "flask-app"})

# ------------------------------------------------------------------------------

if __name__ == "__main__":
    # Serve the whole app under the /app prefix so url_for() matches the public path,
    # and bind to 0.0.0.0 so the root proxy can reach it.
    wrapped = DispatcherMiddleware(Flask("empty"), {"/app": app})
    run_simple("0.0.0.0", 9001, wrapped)