代码改变世界

Web.py Cookbook 简体中文版 - 用cherrypy提供SSL支持

2012-11-23 11:09  justjavac  阅读(213)  评论(0编辑  收藏  举报

问题

如何用内置的cheerypy提供SSL支持?

解法

import web

from web.wsgiserver import CherryPyWSGIServer

CherryPyWSGIServer.ssl_certificate = "path/to/ssl_certificate"
CherryPyWSGIServer.ssl_private_key = "path/to/ssl_private_key"

urls = ("/.*", "hello")
app = web.application(urls, globals())

class hello:
    def GET(self):
        return 'Hello, world!'

if __name__ == "__main__":
    app.run()
无觅相关文章插件,快速提升流量