passenger icon indicating copy to clipboard operation
passenger copied to clipboard

Python asgi support

Open kudlatyamroth opened this issue 4 years ago • 5 comments

Feature request

Question 1: What is the problem?

  • What is the expected behavior? Possibility to run asgi applications like Django asgi, FastApi in asgi mode.

  • What is the actual behavior? Now we can run only wsgi applications with passenger_wsgi

  • How can we reproduce it? Please try to provide a sample application (or Virtual Machine) demonstrating the issue. Otherwise, if we can't reproduce it, we might have to ask you a number of followup questions or run certain commands to try and figure out the problem.

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
async def read_root():
    return {"Hello": "World"}

this is whole sample, FastApi not come with wsgi, only have asgi module

Question 2: Passenger version and integration mode:

6.0.4/nginx

Question 3: OS or Linux distro, platform (including version):

Manjaro x86_64

Question 4: Passenger installation method:

Your answer: [ ] RubyGems + Gemfile [ ] RubyGems, no Gemfile [ ] Phusion APT repo [ ] Phusion YUM repo [ ] OS X Homebrew [x] source tarball [ ] Other, please specify:

Question 5: Your app's programming language (including any version managers) and framework (including versions):

Python 3.8 FastApi 0.54.1

Question 6: Are you using a PaaS and/or containerization? If so which one?

no

kudlatyamroth avatar Apr 24 '20 17:04 kudlatyamroth

Thanks for the suggestion!

CamJN avatar Apr 30 '20 20:04 CamJN

Hello, happy with passenger (mod_passenger apache) workflow. I am also curious about python async / django asgi support.

ionescu77 avatar Mar 02 '21 18:03 ionescu77

Has anybody tried this?

https://github.com/stuxcrystal/passenger_asgi

ionescu77 avatar Mar 02 '21 18:03 ionescu77

I'm interested in this too!

joshlsullivan avatar Jul 04 '21 19:07 joshlsullivan

Hey, we are currently using a2wsgi from https://github.com/abersheeran/a2wsgi to emulate an wsgi interface but as i can understand you loose all the async features because the adapter will wait (pretty inefficient) until asgi yields a response. Haven't tried the https://github.com/stuxcrystal/passenger_asgi so far, but it seems to do similar.

criess avatar Dec 01 '21 08:12 criess