Skip to content

AttributeError: This StreamingHttpResponse instance has no content attribute. Use streaming_content instead. #1945

Closed
@danjac

Description

@danjac

This appears to happen when returning a FileResponse. The issue looks like a regression in 4.4.3.

django==5.0.6
django-debug-toolbar==4.4.3
File "/my-project/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 140, in response_for_exception
    response = handle_uncaught_exception(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/my-project/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 181, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/my-project/.venv/lib/python3.12/site-packages/django_extensions/management/technical_response.py", line 41, in null_technical_500_response
    raise exc_value
  File "/my-project/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/my-project/.venv/lib/python3.12/site-packages/debug_toolbar/middleware.py", line 94, in __call__
    panel.generate_stats(request, response)
  File "/my-project/.venv/lib/python3.12/site-packages/debug_toolbar/panels/alerts.py", line 142, in generate_stats
    html_content = response.content.decode(response.charset)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/my-project/.venv/lib/python3.12/site-packages/django/http/response.py", line 458, in content
    raise AttributeError(
AttributeError: This StreamingHttpResponse instance has no `content` attribute. Use `streaming_content` instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions