layout | title |
---|---|
default |
SSL support in built-in cherrypy server |
Other languages: français | ...
How to set SSL support in built-in cherrypy server web.py
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()
import web
from web.wsgiserver import CherryPyWSGIServer
from web.wsgiserver.ssl_builtin import BuiltinSSLAdapter
ssl_cert = "path/to/ssl_certificate"
ssl_key = "path/to/ssl_private_key"
CherryPyWSGIServer.ssl_adapter = BuiltinSSLAdapter(ssl_cert,ssl_key,None)
urls = ("/.*", "hello")
app = web.application(urls, globals())
class hello:
def GET(self):
return 'Hello, world!'
if __name__ == "__main__":
app.run()