Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Example sub-mounted Flask application

View app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
from flask import Flask, url_for
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
 
app = Flask(__name__)
 
app.config["APPLICATION_ROOT"] = "/abc/123"
 
@app.route("/")
def index():
return "The URL for this page is {}".format(url_for("index"))
 
def simple(env, resp):
resp(b'200 OK', [(b'Content-Type', b'text/plain')])
return [b"Hello WSGI World"]
 
parent_app = DispatcherMiddleware(simple, {"/abc/123": app})
 
if __name__ == "__main__":
run_simple('localhost', 5000, parent_app)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.