Skip to content

Instantly share code, notes, and snippets.

@svieira
Last active October 21, 2019 10:43
Show Gist options
  • Select an option

  • Save svieira/3434cbcaf627e50a4808 to your computer and use it in GitHub Desktop.

Select an option

Save svieira/3434cbcaf627e50a4808 to your computer and use it in GitHub Desktop.

Revisions

  1. svieira revised this gist May 16, 2014. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions app.py
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    from flask import Flask
    from flask import Flask, url_for
    from werkzeug.serving import run_simple
    from werkzeug.wsgi import DispatcherMiddleware

    @@ -11,9 +11,10 @@ def index():
    return "The URL for this page is {}".format(url_for("index"))

    def simple(env, resp):
    resp([b"Hello WSGI World"])
    resp(b'200 OK', [(b'Content-Type', b'text/plain')])
    return [b"Hello WSGI World"]

    parent_app = DispatcherMiddleware(simple, {"/abc/123": app.wsgi_app})
    parent_app = DispatcherMiddleware(simple, {"/abc/123": app})

    if __name__ == "__main__":
    run_simple('localhost', 5000, parent_app)
    run_simple('localhost', 5000, parent_app)
  2. svieira created this gist May 16, 2014.
    19 changes: 19 additions & 0 deletions app.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    from flask import Flask
    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"Hello WSGI World"])

    parent_app = DispatcherMiddleware(simple, {"/abc/123": app.wsgi_app})

    if __name__ == "__main__":
    run_simple('localhost', 5000, parent_app)
    1 change: 1 addition & 0 deletions requirements.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    Flask==0.10.1