本文整理汇总了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
示例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
示例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
示例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
示例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
示例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