django-fastapi-example icon indicating copy to clipboard operation
django-fastapi-example copied to clipboard

Any experience running this, or something similar in production?

Open allen-munsch opened this issue 3 years ago • 1 comments

https://github.com/jordaneremieff/django-fastapi-example/blob/main/django_fastapi/project/asgi.py#L28

Tried using the supplied uvicorn WSGIMiddleware in production and it was a bad time, might have been how it was configured though. Knobs on the number of gunicorn workers, and WSGIMiddelware threads?

I was thinking of something like this:

  • https://github.com/allen-munsch/benchmark-django-fastapi/blob/main/testdjango/fastapi_with_django_mounted_asgi.py

allen-munsch avatar May 14 '21 21:05 allen-munsch

@allen-munsch I've not used this in production myself, and this example was created prior to the introduction of general ASGI support to Django.

I've since created another proof-of-concept taking an approach similar to what you've linked here where the ASGI application is mounted directly rather than the WSGIMiddleware which I'd expect to provide a more seamless integration. That said, I haven't run this extensively or used it with Gunicorn + Uvicorn worker either, but presumably since both expose the common ASGI interface there shouldn't be any issues composing things at that level.

jordaneremieff avatar May 15 '21 07:05 jordaneremieff