• 用cherrypy提供SSL支持
    • 问题
    • 解法

    用cherrypy提供SSL支持

    问题

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

    解法

    1. import web
    2. from web.wsgiserver import CherryPyWSGIServer
    3. CherryPyWSGIServer.ssl_certificate = "path/to/ssl_certificate"
    4. CherryPyWSGIServer.ssl_private_key = "path/to/ssl_private_key"
    5. urls = ("/.*", "hello")
    6. app = web.application(urls, globals())
    7. class hello:
    8. def GET(self):
    9. return 'Hello, world!'
    10. if __name__ == "__main__":
    11. app.run()