[Answered ]-Django broken response with file data

1👍

I’ve solved the issue by using this post (but didn’t find any cause of it):

  1. add django.middleware.gzip.GZipMiddleware middleware to MIDDLEWARE project settings variable.
  2. write a subclass for my existing FileWrapper (code below).

FixedFileWrapper:

class FixedFileWrapper(FileWrapper):
    def __iter__(self):
        self.filelike.seek(0)
        return self

Maybe, someone can explain me the reason my issue?

Leave a comment