Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a standard way to convert an ASGI application to WSGI? #109

Closed
knowsuchagency opened this issue Jul 26, 2019 · 3 comments
Closed

Comments

@knowsuchagency
Copy link

In the same way asgiref.wsgi.WsgiToAsgi converts a WSGI application to ASGI, is there a standard way to convert an ASGI application to WSGI?

My use case is that I want to leverage FastAPI to create my REST api, but I'm working on a legacy flask application. If I can convert my ASGI app to WSGI, I can easily mount it on the legacy application using werkzeug.middleware.dispatcher.DispatcherMiddleware.

@andrewgodwin
Copy link
Member

There's no standard implementation yet but it's definitely possible, if not very efficient (as you'll need to consume one thread per request). I'd happily take one to sit alongside the other adapter, but I'm not personally planning to work on it.

@knowsuchagency
Copy link
Author

Thanks @andrewgodwin -- maybe I'll hack on it a bit and submit a PR

@adriangb
Copy link
Contributor

I think this could be useful in tests, where performance doesn't really matter but being able to swap out a WSGI app for an ASGI app while minimizing the LOC rewritten would be clutch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants