You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gunicorn + uvicorn + ASGI + flask is not working #2153
Add a new file run.py with the contents to convert flask WSGI to ASGI
from app import app
from asgiref.wsgi import WsgiToAsgi
# Convert the Flask WSGI app to ASGI
asgi_app = WsgiToAsgi(app)
if __name__ == '__main__':
app.run(debug=True)
Now run with gunicorn -w 4 run:app or gunicorn -w 4 -k uvicorn.workers.UvicornWorker run:asgi_app
One of our teammates reported the issue and they use asgi with flask. And they reported that the issue happens only with uvicorn. So I just used this sample app to re-create the problem.
Activity
xrmx commentedon Nov 4, 2024
Thanks for reporting. What's the reason to run a wsgi framework in an asgi worker?
sundarv85 commentedon Nov 5, 2024
One of our teammates reported the issue and they use asgi with flask. And they reported that the issue happens only with uvicorn. So I just used this sample app to re-create the problem.