當前位置: 首頁>>代碼示例>>Python>>正文


Python cherrypy.tree方法代碼示例

本文整理匯總了Python中cherrypy.tree方法的典型用法代碼示例。如果您正苦於以下問題:Python cherrypy.tree方法的具體用法?Python cherrypy.tree怎麽用?Python cherrypy.tree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cherrypy的用法示例。


在下文中一共展示了cherrypy.tree方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: application

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import tree [as 別名]
def application(environ, start_response):
    global loaded
    if not loaded:
        loaded = True
        modname = 'cherrypy.test.' + environ['testmod']
        mod = __import__(modname, globals(), locals(), [''])
        mod.setup_server()

        cherrypy.config.update({
            'log.error_file': os.path.join(curdir, 'test.error.log'),
            'log.access_file': os.path.join(curdir, 'test.access.log'),
            'environment': 'test_suite',
            'engine.SIGHUP': None,
            'engine.SIGTERM': None,
        })
    return cherrypy.tree(environ, start_response) 
開發者ID:cherrypy,項目名稱:cherrypy,代碼行數:18,代碼來源:modwsgi.py

示例2: get_app

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import tree [as 別名]
def get_app(self, app=None):
        """Obtain a new (decorated) WSGI app to hook into the origin server."""
        if app is None:
            app = cherrypy.tree

        if self.validate:
            try:
                from wsgiref import validate
            except ImportError:
                warnings.warn(
                    'Error importing wsgiref. The validator will not run.')
            else:
                # wraps the app in the validator
                app = validate.validator(app)

        return app 
開發者ID:cherrypy,項目名稱:cherrypy,代碼行數:18,代碼來源:helper.py

示例3: application

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import tree [as 別名]
def application(environ, start_response):
    import cherrypy
    global loaded
    if not loaded:
        loaded = True
        modname = 'cherrypy.test.' + environ['testmod']
        mod = __import__(modname, globals(), locals(), [''])
        mod.setup_server()

        cherrypy.config.update({
            'log.error_file': os.path.join(curdir, 'test.error.log'),
            'log.access_file': os.path.join(curdir, 'test.access.log'),
            'environment': 'test_suite',
            'engine.SIGHUP': None,
            'engine.SIGTERM': None,
        })
    return cherrypy.tree(environ, start_response) 
開發者ID:morpheus65535,項目名稱:bazarr,代碼行數:19,代碼來源:modwsgi.py

示例4: application

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import tree [as 別名]
def application(environ, start_response):
    import cherrypy
    global loaded
    if not loaded:
        loaded = True
        modname = "cherrypy.test." + environ['testmod']
        mod = __import__(modname, globals(), locals(), [''])
        mod.setup_server()
        
        cherrypy.config.update({
            "log.error_file": os.path.join(curdir, "test.error.log"),
            "log.access_file": os.path.join(curdir, "test.access.log"),
            "environment": "test_suite",
            "engine.SIGHUP": None,
            "engine.SIGTERM": None,
            })
    return cherrypy.tree(environ, start_response) 
開發者ID:binhex,項目名稱:moviegrabber,代碼行數:19,代碼來源:modwsgi.py

示例5: get_app

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import tree [as 別名]
def get_app(self, app=None):
        """Obtain a new (decorated) WSGI app to hook into the origin server."""
        if app is None:
            app = cherrypy.tree
        
        if self.conquer:
            try:
                import wsgiconq
            except ImportError:
                warnings.warn("Error importing wsgiconq. pyconquer will not run.")
            else:
                app = wsgiconq.WSGILogger(app, c_calls=True)
        
        if self.validate:
            try:
                from wsgiref import validate
            except ImportError:
                warnings.warn("Error importing wsgiref. The validator will not run.")
            else:
                #wraps the app in the validator
                app = validate.validator(app)
        
        return app 
開發者ID:binhex,項目名稱:moviegrabber,代碼行數:25,代碼來源:helper.py

示例6: erase_script_name

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import tree [as 別名]
def erase_script_name(environ, start_response):
    environ['SCRIPT_NAME'] = ''
    return cherrypy.tree(environ, start_response) 
開發者ID:cherrypy,項目名稱:cherrypy,代碼行數:5,代碼來源:modfastcgi.py

示例7: start

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import tree [as 別名]
def start(self, modulename):
        cherrypy.server.httpserver = servers.FlupFCGIServer(
            application=cherrypy.tree, bindAddress=('127.0.0.1', 4000))
        cherrypy.server.httpserver.bind_addr = ('127.0.0.1', 4000)
        # For FCGI, we both start apache...
        self.start_apache()
        # ...and our local server
        helper.LocalServer.start(self, modulename) 
開發者ID:cherrypy,項目名稱:cherrypy,代碼行數:10,代碼來源:modfcgid.py

示例8: __init__

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import tree [as 別名]
def __init__(self, server_adapter=cherrypy.server):
        self.server_adapter = server_adapter
        self.max_request_header_size = self.server_adapter.max_request_header_size or 0
        self.max_request_body_size = self.server_adapter.max_request_body_size or 0
        
        server_name = (self.server_adapter.socket_host or
                       self.server_adapter.socket_file or
                       None)
        
        self.wsgi_version = self.server_adapter.wsgi_version
        s = wsgiserver.CherryPyWSGIServer
        s.__init__(self, server_adapter.bind_addr, cherrypy.tree,
                   self.server_adapter.thread_pool,
                   server_name,
                   max = self.server_adapter.thread_pool_max,
                   request_queue_size = self.server_adapter.socket_queue_size,
                   timeout = self.server_adapter.socket_timeout,
                   shutdown_timeout = self.server_adapter.shutdown_timeout,
                   )
        self.protocol = self.server_adapter.protocol_version
        self.nodelay = self.server_adapter.nodelay

        if sys.version_info >= (3, 0):
            ssl_module = self.server_adapter.ssl_module or 'builtin'
        else:
            ssl_module = self.server_adapter.ssl_module or 'pyopenssl'
        if self.server_adapter.ssl_context:
            adapter_class = wsgiserver.get_ssl_adapter_class(ssl_module)
            self.ssl_adapter = adapter_class(
                self.server_adapter.ssl_certificate,
                self.server_adapter.ssl_private_key,
                self.server_adapter.ssl_certificate_chain)
            self.ssl_adapter.context = self.server_adapter.ssl_context
        elif self.server_adapter.ssl_certificate:
            adapter_class = wsgiserver.get_ssl_adapter_class(ssl_module)
            self.ssl_adapter = adapter_class(
                self.server_adapter.ssl_certificate,
                self.server_adapter.ssl_private_key,
                self.server_adapter.ssl_certificate_chain)
        
        self.stats['Enabled'] = getattr(self.server_adapter, 'statistics', False) 
開發者ID:binhex,項目名稱:moviegrabber,代碼行數:43,代碼來源:_cpwsgi_server.py

示例9: __init__

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import tree [as 別名]
def __init__(self, server_adapter=cherrypy.server):
        """Initialize CPWSGIServer instance.

        Args:
            server_adapter (cherrypy._cpserver.Server): ...
        """
        self.server_adapter = server_adapter
        self.max_request_header_size = (
            self.server_adapter.max_request_header_size or 0
        )
        self.max_request_body_size = (
            self.server_adapter.max_request_body_size or 0
        )

        server_name = (self.server_adapter.socket_host or
                       self.server_adapter.socket_file or
                       None)

        self.wsgi_version = self.server_adapter.wsgi_version

        super(CPWSGIServer, self).__init__(
            server_adapter.bind_addr, cherrypy.tree,
            self.server_adapter.thread_pool,
            server_name,
            max=self.server_adapter.thread_pool_max,
            request_queue_size=self.server_adapter.socket_queue_size,
            timeout=self.server_adapter.socket_timeout,
            shutdown_timeout=self.server_adapter.shutdown_timeout,
            accepted_queue_size=self.server_adapter.accepted_queue_size,
            accepted_queue_timeout=self.server_adapter.accepted_queue_timeout,
            peercreds_enabled=self.server_adapter.peercreds,
            peercreds_resolve_enabled=self.server_adapter.peercreds_resolve,
        )
        self.ConnectionClass.RequestHandlerClass = CPWSGIHTTPRequest

        self.protocol = self.server_adapter.protocol_version
        self.nodelay = self.server_adapter.nodelay

        if sys.version_info >= (3, 0):
            ssl_module = self.server_adapter.ssl_module or 'builtin'
        else:
            ssl_module = self.server_adapter.ssl_module or 'pyopenssl'
        if self.server_adapter.ssl_context:
            adapter_class = cheroot.server.get_ssl_adapter_class(ssl_module)
            self.ssl_adapter = adapter_class(
                self.server_adapter.ssl_certificate,
                self.server_adapter.ssl_private_key,
                self.server_adapter.ssl_certificate_chain,
                self.server_adapter.ssl_ciphers)
            self.ssl_adapter.context = self.server_adapter.ssl_context
        elif self.server_adapter.ssl_certificate:
            adapter_class = cheroot.server.get_ssl_adapter_class(ssl_module)
            self.ssl_adapter = adapter_class(
                self.server_adapter.ssl_certificate,
                self.server_adapter.ssl_private_key,
                self.server_adapter.ssl_certificate_chain,
                self.server_adapter.ssl_ciphers)

        self.stats['Enabled'] = getattr(
            self.server_adapter, 'statistics', False) 
開發者ID:cherrypy,項目名稱:cherrypy,代碼行數:62,代碼來源:_cpwsgi_server.py

示例10: __init__

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import tree [as 別名]
def __init__(self, server_adapter=cherrypy.server):
        self.server_adapter = server_adapter
        self.max_request_header_size = (
            self.server_adapter.max_request_header_size or 0
        )
        self.max_request_body_size = (
            self.server_adapter.max_request_body_size or 0
        )

        server_name = (self.server_adapter.socket_host or
                       self.server_adapter.socket_file or
                       None)

        self.wsgi_version = self.server_adapter.wsgi_version
        s = wsgiserver.CherryPyWSGIServer
        s.__init__(self, server_adapter.bind_addr, cherrypy.tree,
                   self.server_adapter.thread_pool,
                   server_name,
                   max=self.server_adapter.thread_pool_max,
                   request_queue_size=self.server_adapter.socket_queue_size,
                   timeout=self.server_adapter.socket_timeout,
                   shutdown_timeout=self.server_adapter.shutdown_timeout,
                   accepted_queue_size=self.server_adapter.accepted_queue_size,
                   accepted_queue_timeout=self.server_adapter.accepted_queue_timeout,
                   )
        self.protocol = self.server_adapter.protocol_version
        self.nodelay = self.server_adapter.nodelay

        if sys.version_info >= (3, 0):
            ssl_module = self.server_adapter.ssl_module or 'builtin'
        else:
            ssl_module = self.server_adapter.ssl_module or 'pyopenssl'
        if self.server_adapter.ssl_context:
            adapter_class = wsgiserver.get_ssl_adapter_class(ssl_module)
            self.ssl_adapter = adapter_class(
                self.server_adapter.ssl_certificate,
                self.server_adapter.ssl_private_key,
                self.server_adapter.ssl_certificate_chain)
            self.ssl_adapter.context = self.server_adapter.ssl_context
        elif self.server_adapter.ssl_certificate:
            adapter_class = wsgiserver.get_ssl_adapter_class(ssl_module)
            self.ssl_adapter = adapter_class(
                self.server_adapter.ssl_certificate,
                self.server_adapter.ssl_private_key,
                self.server_adapter.ssl_certificate_chain)

        self.stats['Enabled'] = getattr(
            self.server_adapter, 'statistics', False) 
開發者ID:naparuba,項目名稱:opsbro,代碼行數:50,代碼來源:_cpwsgi_server.py


注:本文中的cherrypy.tree方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。