当前位置: 首页>>代码示例>>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;未经允许,请勿转载。