Source

CherryPy Recipes / deployment / tls / ssl_and_plain_servers.py

Full commit
# -*- coding: utf-8 -*-
import cherrypy

class Root(object):
    @cherrypy.expose
    def index(self):
        return "hello world using: %s" % cherrypy.request.scheme

if __name__ == '__main__':
    cherrypy.config.update({'server.socket_port': 8090})

    from cherrypy._cpserver import Server
    server = Server()
    server.socket_port = 8091
    server.ssl_certificate = './server.crt'
    server.ssl_private_key = './server.key'
    server.subscribe()
    
    cherrypy.quickstart(Root())