From a390cc710939365e58e6dc98ec282e532f71a3f9 Mon Sep 17 00:00:00 2001 From: Windson yang Date: Mon, 2 Apr 2018 23:39:29 +0800 Subject: [PATCH] [2.0.x] Fixed #29278 -- Doc'd that a context manager can't be used with FileResponse. Backport of 4fe5d846666d46a5395a5f0ea2845a96b6837a75 from master --- docs/ref/request-response.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 77298b5bbf..aca839469b 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -1050,3 +1050,5 @@ otherwise it streams the file out in small chunks. >>> from django.http import FileResponse >>> response = FileResponse(open('myfile.png', 'rb')) + +The file will be closed automatically, so don't open it with a context manager.