#9106 closed Uncategorized (wontfix)
django.views.static.serve reads entire file in to memory
Reported by: | Michael Manfre | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
django.views.static.serve eats a lot of memory when serving large files in a dev environment. Instead of doing open(fullpath, 'rb').read(), it would be friendlier if it passed an iterator to HttpResponse.
Attached is a patch.
Attachments (1)
Change History (5)
by , 16 years ago
Attachment: | django-static-serve-chunks.diff added |
---|
comment:1 by , 16 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I don't think this is worth it. We're not guaranteeing that HttpResponse won't read the contents into memory either (which might be necessary to fix some other bugs). This is the development server. If things are getting that tight memory-wise, you can fairly rapidly switch to using a real webserver for serving the static data.
It's fairly borderline, but things like this that are trying to extend the envelope for the development server "just a bit further" usually feel like cases where you should just configure Apache or something and use that. It's not that hard.
comment:4 by , 12 years ago
Easy pickings: | unset |
---|---|
Severity: | → Normal |
Type: | → Uncategorized |
UI/UX: | unset |
Well, this was reported again as #15281 and fixed.
This is a small part of a much larger issue. See #7581 for some discussion of the various subtle challenges to streaming HttpResponses.