#2131: [patch] HttpResponseSendFile for serving static files handler-specific sendfile mechanism -----------------------------------------------+---------------------------- Reporter: ymasuda[at]ethercube.com | Owner: alsleme Status: new | Milestone: Component: Core framework | Version: SVN Resolution: | Keywords: Stage: Design decision needed | Has_patch: 1 Needs_docs: 0 | Needs_tests: 1 Needs_better_patch: 0 | -----------------------------------------------+---------------------------- Comment (by mizatservercave):
Regarding the 'v1.2' version of the patch I just uploaded, note that for large files when accessed through response.content loads the whole thing up into the webserver's RAM before serving. A good test example is OpenOffice.org 3's 143MB installer. Bad for small (eg, 256MB RAM) webservers. RAM also seems to 'hang around' after each request, so I suspect that .close() isn't being called properly on self._container, or _get_content needs to add a signal-hook to signals.request_finished to expire the content from RAM by deleting the variable or setting it to '' or somesuch. That being said, accessing request.content is a compatibility property, and so shouldn't be used if at all possible. The below test-case works for a raw, manual test, however, in addition to working with the "_test" patch above: from django.http import HttpResponseSendFile r = HttpResponseSendFile('./bigfile') t = open('/tmp/test', 'wb') t.write(r.content) t.close() # md5 and filesize of ./bigfile and /tmp/test match. -- Ticket URL: <http://code.djangoproject.com/ticket/2131#comment:25> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---