Best way to modify Djangos ASGIHandler?

I’d like to build a third party package including async file responses. But to get them to work, I need to modify the ASGIHandler of Django. What would be the preferred way to achieve this? Things I already thought of:

  • Just provide an own AsyncFileASGIHandler and have an example on how to use it in the docs
  • Provide a special get_asgi_application function and tell users to use it
  • Just monkeypatch ASGIHandler on application start

Decided to use get_asgi_application for now :slight_smile:

django_fileresponse