django return file over HttpResponse - file is not served correctly

后端 未结 3 487
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 07:40

I want to return some files in a HttpResponse and I\'m using the following function. The file that is returned always has a filesize of 1kb and I do not know why. I can open

3条回答
  •  离开以前
    2020-12-29 08:17

    Try disabling "django.middleware.gzip.GZipMiddleware" from your MIDDLEWARE_CLASSES in settings.py

    I had the same problem, and after I looked around the middleware folder, this middleware seemed guilty to me and removing it did the trick for me.

提交回复
热议问题