A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/encode/starlette/issues/380 below:

Combining mountpoints · Issue #380 · encode/starlette · GitHub

We have:

# new_app.py
from starlette.applications import Starlette
from starlette.responses import PlainTextResponse

app = Starlette()

@app.route('/method1')
async def homepage(request):
    return PlainTextResponse("method1")
# old_app.py
from flask import Flask
app = Flask(__name__)

@app.route("/method2")
def hello():
    return "method2"
# main.py
from starlette.applications import Starlette
from starlette.responses import PlainTextResponse
from starlette.middleware.wsgi import WSGIMiddleware

import uvicorn

from old_app import app as old_app
from new_app import app as new_app

app = Starlette()
app.debug = True

app.mount("", new_app)
app.mount("", WSGIMiddleware(old_app.wsgi_app))

if __name__ == '__main__':
    uvicorn.run(app, host='0.0.0.0', port=8000)

In current implementation:

If we change order of mounts like this:

app.mount("", WSGIMiddleware(old_app.wsgi_app))
app.mount("", new_app)

How to make /method1 and /method2 both to work?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4