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


Python scgi.WSGIServer方法代碼示例

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


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

示例1: start

# 需要導入模塊: from flup.server import scgi [as 別名]
# 或者: from flup.server.scgi 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 scgi [as 別名]
# 或者: from flup.server.scgi 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 scgi [as 別名]
# 或者: from flup.server.scgi 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

示例4: runscgi

# 需要導入模塊: from flup.server import scgi [as 別名]
# 或者: from flup.server.scgi 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

示例5: makeserver

# 需要導入模塊: from flup.server import scgi [as 別名]
# 或者: from flup.server.scgi 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

示例6: runfcgi

# 需要導入模塊: from flup.server import scgi [as 別名]
# 或者: from flup.server.scgi 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


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