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


Python fcgi.WSGIServer方法代码示例

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


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

示例1: start

# 需要导入模块: from flup.server import fcgi [as 别名]
# 或者: from flup.server.fcgi import WSGIServer [as 别名]
def start(self):
        """Start the FCGI server."""
        # We have to instantiate the server class here because its __init__
        # starts a threadpool. If we do it too early, daemonize won't work.
        from flup.server.fcgi import WSGIServer
        self.fcgiserver = WSGIServer(*self.args, **self.kwargs)
        # TODO: report this bug upstream to flup.
        # If we don't set _oldSIGs on Windows, we get:
        #   File "C:\Python24\Lib\site-packages\flup\server\threadedserver.py",
        #   line 108, in run
        #     self._restoreSignalHandlers()
        #   File "C:\Python24\Lib\site-packages\flup\server\threadedserver.py",
        #   line 156, in _restoreSignalHandlers
        #     for signum,handler in self._oldSIGs:
        #   AttributeError: 'WSGIServer' object has no attribute '_oldSIGs'
        self.fcgiserver._installSignalHandlers = lambda: None
        self.fcgiserver._oldSIGs = []
        self.ready = True
        self.fcgiserver.run() 
开发者ID:cherrypy,项目名称:cherrypy,代码行数:21,代码来源:servers.py

示例2: runscgi

# 需要导入模块: from flup.server import fcgi [as 别名]
# 或者: from flup.server.fcgi import WSGIServer [as 别名]
def runscgi(func):
    """Runs a WSGI-function with an SCGI server."""
    from flup.server.scgi import WSGIServer
    my_server = makeserver(WSGIServer)
    if len(sys.argv) > 2: # progname, scgi
        args = sys.argv[:]
        args.remove('scgi')
        hostport = validaddr(args[1])
    else:
        hostport = ('localhost', 4000)
    return my_server(func, bindAddress=hostport).run()


##########################################################
## Debugging
########################################################## 
开发者ID:hhstore,项目名称:annotated-py-projects,代码行数:18,代码来源:web.py

示例3: runfcgi

# 需要导入模块: from flup.server import fcgi [as 别名]
# 或者: from flup.server.fcgi import WSGIServer [as 别名]
def runfcgi(func):
    """Runs a WSGI-function with a FastCGI server."""
    from flup.server.fcgi import WSGIServer
    if len(sys.argv) > 2: # progname, scgi
        args = sys.argv[:]
        if 'fastcgi' in args: args.remove('fastcgi')
        elif 'fcgi' in args: args.remove('fcgi')
        hostport = validaddr(args[1])
    elif len(sys.argv) > 1:
        hostport = ('localhost', 8000)
    else:
        hostport = None
    return makeserver(WSGIServer)(func, multiplexed=True, bindAddress=hostport).run() 
开发者ID:hhstore,项目名称:annotated-py-projects,代码行数:15,代码来源:web.py

示例4: runfcgi

# 需要导入模块: from flup.server import fcgi [as 别名]
# 或者: from flup.server.fcgi import WSGIServer [as 别名]
def runfcgi(func, addr=('localhost', 8000)):
    """Runs a WSGI function as a FastCGI server."""
    import flup.server.fcgi as flups
    return flups.WSGIServer(func, multiplexed=True, bindAddress=addr, debug=False).run() 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:6,代码来源:wsgi.py

示例5: runscgi

# 需要导入模块: from flup.server import fcgi [as 别名]
# 或者: from flup.server.fcgi import WSGIServer [as 别名]
def runscgi(func, addr=('localhost', 4000)):
    """Runs a WSGI function as an SCGI server."""
    import flup.server.scgi as flups
    return flups.WSGIServer(func, bindAddress=addr, debug=False).run() 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:6,代码来源:wsgi.py

示例6: makeserver

# 需要导入模块: from flup.server import fcgi [as 别名]
# 或者: from flup.server.fcgi import WSGIServer [as 别名]
def makeserver(wsgi_server):
    """Updates a flup-style WSGIServer with web.py-style error support."""
    class MyServer(wsgi_server):
        def error(self, req):
            w = req.stdout.write
            internalerror()
            w('Status: ' + ctx.status + '\r\n')
            for (h, v) in ctx.headers:
                w(h + ': ' + v + '\r\n')
            w('\r\n' + ctx.output)

    return MyServer 
开发者ID:hhstore,项目名称:annotated-py-projects,代码行数:14,代码来源:web.py


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