简体   繁体   English

将Bottle与Cherrypy一起使用时如何gzip响应?

[英]How to gzip response while using Bottle with Cherrypy?

我想在应用程序级别而不是针对单个请求进行上述操作。配置文件中的另一种一次性解决方案/设置将其设置为服务器的默认设置将很有帮助。

use tools.gzip.on: True on cherrypy config file. 使用tools.gzip.on: Truetools.gzip.on: True配置文件上为tools.gzip.on: True See this link 看到这个链接

Also Instead if you can use uwsgi, you can add this to your config: 另外,如果可以使用uwsgi,可以将其添加到配置中:

route-if = contains:${HTTP_ACCEPT_ENCODING};gzip goto:mygzipper
route-run = last:

route-label = mygzipper
; pass the response to the gzip transformation
route = .* delheader:Content-Length
route = .* gzip:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM