Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#31594 closed Bug (fixed)

Add get_response_async for ASGIStaticFilesHandler

Reported by: Joshua Massover Owned by: Joshua Massover
Component: contrib.staticfiles Version: 3.1
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It looks like the StaticFilesHandlerMixin is missing the the async response function.

Without this, when trying to use the ASGIStaticFilesHandler, this is the traceback:

Exception inside application: 'NoneType' object is not callable
Traceback (most recent call last):
  File ".../lib/python3.7/site-packages/daphne/cli.py", line 30, in asgi
    await self.app(scope, receive, send)
  File ".../src/django/django/contrib/staticfiles/handlers.py", line 86, in __call__
    return await super().__call__(scope, receive, send)
  File ".../src/django/django/core/handlers/asgi.py", line 161, in __call__
    response = await self.get_response_async(request)
  File ".../src/django/django/core/handlers/base.py", line 148, in get_response_async
    response = await self._middleware_chain(request)
TypeError: 'NoneType' object is not callable

Change History (6)

comment:1 by Joshua Massover, 5 years ago

Summary: Add get_response_async for ASGIStaticFilesHandlerMixinAdd get_response_async for ASGIStaticFilesHandler

comment:2 by Simon Charette, 5 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Left comments on the PR regarding the fact the we don't have a way of serving files asynchronously so far. From what I know local file I/O requires some form of thread pooling to work correctly.

comment:3 by Carlton Gibson, 4 years ago

Needs tests: set
Patch needs improvement: unset

comment:4 by Mariusz Felisiak, 4 years ago

Component: Uncategorizedcontrib.staticfiles
Needs tests: unset
Owner: changed from nobody to Joshua Massover
Status: newassigned
Triage Stage: AcceptedReady for checkin
Version: 3.03.1

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 92309e53:

Fixed #31594 -- Added ASGIStaticFilesHandler.get_response_async().

comment:6 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In 3fb69756:

[3.1.x] Fixed #31594 -- Added ASGIStaticFilesHandler.get_response_async().

Backport of 92309e53d9921a60e667656d8dd65e59eb5cf81c from master

Note: See TracTickets for help on using tickets.
Back to Top