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


Python wsgi.server方法代码示例

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


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

示例1: urlparts

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import server [as 别名]
def urlparts(self):
        ''' The :attr:`url` string as an :class:`urlparse.SplitResult` tuple.
            The tuple contains (scheme, host, path, query_string and fragment),
            but the fragment is always empty because it is not visible to the
            server. '''
        env = self.environ
        http = env.get('HTTP_X_FORWARDED_PROTO') or env.get('wsgi.url_scheme', 'http')
        host = env.get('HTTP_X_FORWARDED_HOST') or env.get('HTTP_HOST')
        if not host:
            # HTTP 1.1 requires a Host-header. This is for HTTP/1.0 clients.
            host = env.get('SERVER_NAME', '127.0.0.1')
            port = env.get('SERVER_PORT')
            if port and port != ('80' if http == 'http' else '443'):
                host += ':' + port
        path = urlquote(self.fullpath)
        return UrlSplitResult(http, host, path, env.get('QUERY_STRING'), '') 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:18,代码来源:__init__.py

示例2: run

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import server [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 gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import server [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: script_name

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import server [as 别名]
def script_name(self):
        ''' The initial portion of the URL's `path` that was removed by a higher
            level (server or routing middleware) before the application was
            called. This script path is returned with leading and tailing
            slashes. '''
        script_name = self.environ.get('SCRIPT_NAME', '').strip('/')
        return '/' + script_name + '/' if script_name else '/' 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:9,代码来源:__init__.py

示例5: auth

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import server [as 别名]
def auth(self):
        """ HTTP authentication data as a (user, password) tuple. This
            implementation currently supports basic (not digest) authentication
            only. If the authentication happened at a higher level (e.g. in the
            front web-server or a middleware), the password field is None, but
            the user field is looked up from the ``REMOTE_USER`` environ
            variable. On any errors, None is returned. """
        basic = parse_auth(self.environ.get('HTTP_AUTHORIZATION',''))
        if basic: return basic
        ruser = self.environ.get('REMOTE_USER')
        if ruser: return (ruser, None)
        return None 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:14,代码来源:__init__.py

示例6: run

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import server [as 别名]
def run(self, handler): # pragma: no cover
        import flup.server.fcgi
        self.options.setdefault('bindAddress', (self.host, self.port))
        flup.server.fcgi.WSGIServer(handler, **self.options).run() 
开发者ID:exiahuang,项目名称:SalesforceXyTools,代码行数:6,代码来源:bottle.py


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