Cherrypy 3.2.0:启动引擎以在同一实例中运行HTTP和HTTPS

时间:2013-12-14 08:50:13

标签: http python-3.x https cherrypy

早上好,

我在HTTP或HTTPS中成功启动了cherrypy 3.2.0引擎:

# ssl variable commes input parameters. Bellow cherrypy configuration is fully configured

if ssl:
    print('Setting up SSL')
    cherrypy.server.ssl_certificate = "conf/private/" + platform.node() + ".crt"
    cherrypy.server.ssl_private_key = "conf/private/" + platform.node() + ".key"


'''
----------------------------------
Start server instance
----------------------------------
'''
if hasattr(cherrypy.engine, 'block'):
    # 3.1 syntax
    cherrypy.engine.start()
    cherrypy.engine.block()
else:
    # 3.0 syntax
    cherrypy.server.quickstart(cherrypy.root, config=py_app_conf)
    cherrypy.engine.start() 

那么,是否可以在同一台樱桃服务器中配置cherrypy以在http和https中启动?

感谢ypur回复。

1 个答案:

答案 0 :(得分:3)

您需要在不同的端口上安装两台服务器:Multiple servers/ports。此外,还有一个多服务器配置功能似乎没有记录,看看它是否适合您,请参考_server_namespace_handler()中的_cpconfig.py功能。