Closed provinzkraut closed 1 year ago
Have a look at https://github.com/piccolo-orm/piccolo_admin/issues/211
Oh, I actually never encountered that. Let's defer this then until #681 is resolved.
@provinzkraut You can use the example from Starlite Piccolo asgi template which I think is a good example of how to mount a separate asgi application.
This is doable yourself with FastAPI exports this functionality from Starlette, which itself uses https://github.com/abersheeran/a2wsgi.
@provinzkraut: FastAPI exports this functionality from Starlette, which itself uses https://github.com/abersheeran/a2wsgi You can simply use a2wsgi directly with Litestar (= The wrapped app can the simply be "mounted" using the asgi route handler: https://docs.litestar.dev/2/usage/route-handlers.html#asgi-route-handlers
ref: https://discord.com/channels/919193495116337154/1129080604328210473/1129081298238050346
Example:
from litestar import Litestar, asgi
from a2wsgi import WSGIMiddleware
from flask import Flask
flask_app = Flask(__name__)
asgi_flask_app = asgi(path="/", is_mount=True)(
WSGIMiddleware(flask_app)
)
app = Litestar(route_handler=[asgi_flask_app])
Maybe I misunderstood the intent here - We can re-open if we want to add documentation about using a2wsgi into our docs?
It was more about showing how to mount existing ASGI apps. Just an example with an explanation really.
Gotcha. my bad 😬
A new user asked on our if starlite would support "submounting applications" like FastAPI does. While it is supported via the
asgi
handler, this usage is not apparent to new users / users who aren't too familiar with ASGI conceptually.We should add a usage example that demonstrates how to do this.