【问题标题】:How to gzip response while using Bottle with Cherrypy?使用带有 Cherrypy 的瓶子时如何 gzip 响应?
【发布时间】:2015-12-08 09:25:23
【问题描述】:

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

【问题讨论】:

    标签: python compression gzip cherrypy bottle


    【解决方案1】:

    在cherrypy 配置文件上使用tools.gzip.on: True。 看到这个link

    此外,如果您可以使用 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:
    

    【讨论】:

      猜你喜欢
      • 2014-05-18
      • 1970-01-01
      • 2011-04-08
      • 1970-01-01
      • 2017-05-02
      • 2015-08-15
      • 1970-01-01
      • 2017-03-26
      • 2015-06-30
      相关资源
      最近更新 更多