配置的三种方式

第一种
app.conf
[/]
tools.gzip.on: True
test.py
cherrypy.quickstart(myapp, '/', "app.conf")
 
第二种

class Root(object):
    @cherrypy.expose
    @cherrypy.tools.gzip()
    def index(self):
        return "hello world!"
 
 
第三种
class Root(object):
    @cherrypy.expose
    def index(self):
        return "hello world!"
    index._cp_config = {'tools.gzip.on': True} 

posted @ 2020-12-23 15:39  anobscureretreat  阅读(218)  评论(0编辑  收藏  举报