當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。