5

I'm having trouble deploying a FastAPI app on cpanel with Passenger

Hlabs
  • 55
  • 1
  • 7
  • 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 Answers2

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
2

Applied the python package a2wsgi for resolving the problem but it's not working.

saroj
  • 41
  • 2