如何在Heroku Cedar上启用gzip压缩(Python / Flask / Gunicorn)

如何在新的Heroku雪松堆栈上启用GZIP压缩?这是直接从他们的site

Since requests to Cedar apps are made directly to the application server – not proxied through an HTTP server like nginx – any compression of responses must be done within your application. For Rack apps, this can be accomplished with the Rack::Deflater middleware. For gzipped static assets, make sure that Rack::Deflater is loaded before ActionDispatch::Static in your middleware stack.

如果我正确阅读,我的Python应用程序代码现在负责gzip的响应?我如何压缩我的静态资产(例如css / js)?我使用的是Flask和GUnicorn.

翻译自:https://stackoverflow.com/questions/7680947/how-to-enable-gzip-compression-on-heroku-cedar-python-flask-gunicorn

转载注明原文:如何在Heroku Cedar上启用gzip压缩(Python / Flask / Gunicorn)