django-compression-middleware icon indicating copy to clipboard operation
django-compression-middleware copied to clipboard

Provide a way to disable compression per view

Open friedelwolff opened this issue 5 years ago • 1 comments

For some views (e.g. views generating already compressed file types like PDF, PNG, etc) it isn't worth trying to compress them. It would be useful to be able to exclude certain views from the middleware's automatic compression.

friedelwolff avatar Aug 10 '19 13:08 friedelwolff

I have an idea - was poking around Django's docs, and suddenly realized that Django's @csrf_exempt decorator serves the same purpose as what we want to do here: prevent a piece of middleware from running against a specific view. So I'll dig into that and maybe we can do it the same way.

psyonara avatar Oct 15 '19 14:10 psyonara