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


Python WSGIServer.run方法代码示例

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


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

示例1: FlupSCGIServer

# 需要导入模块: from flup.server.cgi import WSGIServer [as 别名]
# 或者: from flup.server.cgi.WSGIServer import run [as 别名]
class FlupSCGIServer(object):
    """Adapter for a flup.server.scgi.WSGIServer."""

    def __init__(self, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs
        self.ready = False

    def start(self):
        """Start the SCGI 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.scgi import WSGIServer
        self.scgiserver = 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.scgiserver._installSignalHandlers = lambda: None
        self.scgiserver._oldSIGs = []
        self.ready = True
        self.scgiserver.run()

    def stop(self):
        """Stop the HTTP server."""
        self.ready = False
        # Forcibly stop the scgi server main event loop.
        self.scgiserver._keepGoing = False
        # Force all worker threads to die off.
        self.scgiserver._threadPool.maxSpare = 0
开发者ID:131db,项目名称:emotweets,代码行数:37,代码来源:servers.py

示例2: FlupCGIServer

# 需要导入模块: from flup.server.cgi import WSGIServer [as 别名]
# 或者: from flup.server.cgi.WSGIServer import run [as 别名]
class FlupCGIServer(object):

    def __init__(self, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs
        self.ready = False

    def start(self):
        from flup.server.cgi import WSGIServer
        self.cgiserver = WSGIServer(*self.args, **self.kwargs)
        self.ready = True
        self.cgiserver.run()

    def stop(self):
        self.ready = False
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:17,代码来源:servers.py

示例3: FlupFCGIServer

# 需要导入模块: from flup.server.cgi import WSGIServer [as 别名]
# 或者: from flup.server.cgi.WSGIServer import run [as 别名]
class FlupFCGIServer(object):

    """Adapter for a flup.server.fcgi.WSGIServer."""

    def __init__(self, *args, **kwargs):
        if kwargs.get("bindAddress", None) is None:
            import socket

            if not hasattr(socket, "fromfd"):
                raise ValueError(
                    "Dynamic FCGI server not available on this platform. "
                    "You must use a static or external one by providing a "
                    "legal bindAddress."
                )
        self.args = args
        self.kwargs = kwargs
        self.ready = False

    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()

    def stop(self):
        """Stop the HTTP server."""
        # Forcibly stop the fcgi server main event loop.
        self.fcgiserver._keepGoing = False
        # Force all worker threads to die off.
        self.fcgiserver._threadPool.maxSpare = self.fcgiserver._threadPool._idleCount
        self.ready = False
开发者ID:gh-fml,项目名称:headphones,代码行数:48,代码来源:servers.py

示例4: FlupSCGIServer

# 需要导入模块: from flup.server.cgi import WSGIServer [as 别名]
# 或者: from flup.server.cgi.WSGIServer import run [as 别名]
class FlupSCGIServer(object):

    def __init__(self, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs
        self.ready = False

    def start(self):
        from flup.server.scgi import WSGIServer
        self.scgiserver = WSGIServer(*self.args, **self.kwargs)
        self.scgiserver._installSignalHandlers = lambda : None
        self.scgiserver._oldSIGs = []
        self.ready = True
        self.scgiserver.run()

    def stop(self):
        self.ready = False
        self.scgiserver._keepGoing = False
        self.scgiserver._threadPool.maxSpare = 0
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:21,代码来源:servers.py

示例5: FlupCGIServer

# 需要导入模块: from flup.server.cgi import WSGIServer [as 别名]
# 或者: from flup.server.cgi.WSGIServer import run [as 别名]
class FlupCGIServer(object):
    """Adapter for a flup.server.cgi.WSGIServer."""

    def __init__(self, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs
        self.ready = False

    def start(self):
        """Start the CGI 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.cgi import WSGIServer

        self.cgiserver = WSGIServer(*self.args, **self.kwargs)
        self.ready = True
        self.cgiserver.run()

    def stop(self):
        """Stop the HTTP server."""
        self.ready = False
开发者ID:131db,项目名称:emotweets,代码行数:23,代码来源:servers.py

示例6: FlupFCGIServer

# 需要导入模块: from flup.server.cgi import WSGIServer [as 别名]
# 或者: from flup.server.cgi.WSGIServer import run [as 别名]
class FlupFCGIServer(object):

    def __init__(self, *args, **kwargs):
        if kwargs.get('bindAddress', None) is None:
            import socket
            if not hasattr(socket, 'fromfd'):
                raise ValueError('Dynamic FCGI server not available on this platform. You must use a static or external one by providing a legal bindAddress.')
        self.args = args
        self.kwargs = kwargs
        self.ready = False

    def start(self):
        from flup.server.fcgi import WSGIServer
        self.fcgiserver = WSGIServer(*self.args, **self.kwargs)
        self.fcgiserver._installSignalHandlers = lambda : None
        self.fcgiserver._oldSIGs = []
        self.ready = True
        self.fcgiserver.run()

    def stop(self):
        self.fcgiserver._keepGoing = False
        self.fcgiserver._threadPool.maxSpare = self.fcgiserver._threadPool._idleCount
        self.ready = False
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:25,代码来源:servers.py


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