I'm having trouble deploying a FastAPI app on cpanel with Passenger
Asked
Active
Viewed 3,826 times
5
-
Passenger at the moment only supports WSGI. FastAPI uses ASGI, so it's not possible to deploy it on Passenger at the moment. There is an open issue to support ASGI apps on passenger: https://github.com/phusion/passenger/issues/2272 There also is an issue on asgiref to convert ASGI to WSGI: https://github.com/django/asgiref/issues/109 – pypae Dec 04 '20 at 16:40
2 Answers
8
You might be able to run your FastAPI app using a2wsgi
:
In your passenger_wsgi.py
:
from a2wsgi import ASGIMiddleware
from main import app # Import your FastAPI app.
application = ASGIMiddleware(app)

pypae
- 639
- 6
- 16
-
-
-
@DoctorHe Django already uses the WSGI spec. You don't need to convert it in any way. See https://www.phusionpassenger.com/library/deploy/wsgi_spec.html for reference. – pypae Feb 23 '22 at 13:48
-
@pypae i wanted to use the "django channels" library and it uses asgi. – DoctorHe Feb 26 '22 at 08:45