当前位置: 首页>>代码示例>>Python>>正文


Python wsgiserver.CherryPyWSGIServer方法代码示例

本文整理汇总了Python中cherrypy.wsgiserver.CherryPyWSGIServer方法的典型用法代码示例。如果您正苦于以下问题:Python wsgiserver.CherryPyWSGIServer方法的具体用法?Python wsgiserver.CherryPyWSGIServer怎么用?Python wsgiserver.CherryPyWSGIServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cherrypy.wsgiserver的用法示例。


在下文中一共展示了wsgiserver.CherryPyWSGIServer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from cherrypy import wsgiserver [as 别名]
# 或者: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
def run(self, handler):
        try:
            # First try to use the new version
            from cheroot.ssl.pyopenssl import pyOpenSSLAdapter
            from cheroot import wsgi
            server = wsgi.Server((self.host, self.port), handler, request_queue_size=32)
        except Exception:
            from cherrypy.wsgiserver.ssl_pyopenssl import pyOpenSSLAdapter
            from cherrypy import wsgiserver
            server = wsgiserver.CherryPyWSGIServer((self.host, self.port), handler, request_queue_size=32)

        self.srv = server

        # If cert variable is has a valid path, SSL will be used
        # You can set it to None to disable SSL
        server.ssl_adapter = pyOpenSSLAdapter(Config.REST_SSL_CERTFILE,
                                              Config.REST_SSL_KEYFILE,
                                              Config.REST_SSL_CA_CERTS)
        try:
            server.start()
        finally:
            server.stop() 
开发者ID:grycap,项目名称:im,代码行数:24,代码来源:REST.py

示例2: run

# 需要导入模块: from cherrypy import wsgiserver [as 别名]
# 或者: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:24,代码来源:__init__.py

示例3: run

# 需要导入模块: from cherrypy import wsgiserver [as 别名]
# 或者: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler
        
        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']
        
        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile
        
        try:
            server.start()
        finally:
            server.stop() 
开发者ID:GoogleCloudPlatform,项目名称:appengine-bottle-skeleton,代码行数:24,代码来源:bottle.py

示例4: main

# 需要导入模块: from cherrypy import wsgiserver [as 别名]
# 或者: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
def main():
    server_type = "werkzeug"
    if not config.debug_mode:
        server_type = "cherrypy"
    if config.web_server_type:
        server_type = config.web_server_type

    assert server_type in ("werkzeug", "cherrypy"), "Only werkzeug and cherrypy supported"

    if server_type == "werkzeug":
        assert config.debug_mode, "Refusing to use werkzeug outside of debug mode"
        app.run(config.web_host, config.web_port, debug=True, use_reloader=False, use_debugger=True,
                threaded=True)
    elif server_type == "cherrypy":
        dispatcher = wsgiserver.WSGIPathInfoDispatcher({"/": app})
        web_server = wsgiserver.CherryPyWSGIServer((config.web_host, config.web_port),
                                                   dispatcher,
                                                   server_name=config.web_public_host)
        web_server.start() 
开发者ID:octobear2,项目名称:ob2,代码行数:21,代码来源:__init__.py

示例5: run

# 需要导入模块: from cherrypy import wsgiserver [as 别名]
# 或者: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
def run(self, handler):  # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
开发者ID:warriorframework,项目名称:warriorframework,代码行数:24,代码来源:bottle.py

示例6: run

# 需要导入模块: from cherrypy import wsgiserver [as 别名]
# 或者: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        server = wsgiserver.CherryPyWSGIServer((self.host, self.port), handler)
        try:
            server.start()
        finally:
            server.stop() 
开发者ID:exiahuang,项目名称:SalesforceXyTools,代码行数:9,代码来源:bottle.py

示例7: run

# 需要导入模块: from cherrypy import wsgiserver [as 别名]
# 或者: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
def run(self, handler):
        from cherrypy import wsgiserver

        server = wsgiserver.CherryPyWSGIServer((self.host, self.port), handler)
        server.start() 
开发者ID:hhstore,项目名称:annotated-py-bottle,代码行数:7,代码来源:bottle.py

示例8: run

# 需要导入模块: from cherrypy import wsgiserver [as 别名]
# 或者: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        server = wsgiserver.CherryPyWSGIServer((self.host, self.port), handler)
        server.start() 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:6,代码来源:bottle2.py

示例9: run_on_cherrypy_for_production

# 需要导入模块: from cherrypy import wsgiserver [as 别名]
# 或者: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
def run_on_cherrypy_for_production():
    '''
    run on cherrypy without auto_reload option
    '''
    from cherrypy import wsgiserver
    dispatch = wsgiserver.WSGIPathInfoDispatcher({'/': app})
    server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', web_conf.PORT), dispatch)

    try:
        server.start()
    except KeyboardInterrupt:
        server.stop() 
开发者ID:harryliu,项目名称:edwin,代码行数:14,代码来源:runserver.py

示例10: get_server

# 需要导入模块: from cherrypy import wsgiserver [as 别名]
# 或者: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
def get_server(address, port, application):
    def _serve(server):
        server.start()
    server = wsgiserver.CherryPyWSGIServer((address, int(port)), application)
    t = threading.Thread(target=_serve, args=(server,))
    t.daemon = True
    return (t, server) 
开发者ID:gosquadron,项目名称:squadron,代码行数:9,代码来源:server.py


注:本文中的cherrypy.wsgiserver.CherryPyWSGIServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。