def process_response(self, request, response): compress = getattr(settings, "COMPRESS_HTML", not settings.DEBUG) if compress: response.content = compress_html(response.content) return response
def compress(*args, **kwargs): response = f(*args, **kwargs) if response.status_code == 200 and 'text/html' in response['Content-Type']: response.content = compress_html(response.content) return response