Is there a way to deploy a fastapi app on cpanel?
Asked Answered
L

1

8

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

Lunular answered 2/12, 2020 at 18:47 Comment(1)
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: github.com/phusion/passenger/issues/2272 There also is an issue on asgiref to convert ASGI to WSGI: github.com/django/asgiref/issues/109Oralla
O
9

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)
Oralla answered 4/12, 2020 at 16:47 Comment(4)
How to start this app with uvicorn?Foldaway
i applied it for a django app but it didn't work.Insatiate
@Insatiate Django already uses the WSGI spec. You don't need to convert it in any way. See phusionpassenger.com/library/deploy/wsgi_spec.html for reference.Oralla
@Oralla i wanted to use the "django channels" library and it uses asgi.Insatiate

© 2022 - 2024 — McMap. All rights reserved.