def __init__(self, application, environ=None, multithreaded=True, multiprocess=False, bindAddress=None, umask=None, multiplexed=False, debug=True, roles=(FCGI_RESPONDER,), forceCGI=False, **kw): """ environ, if present, must be a dictionary-like object. Its contents will be copied into application's environ. Useful for passing application-specific variables. bindAddress, if present, must either be a string or a 2-tuple. If present, run() will open its own listening socket. You would use this if you wanted to run your application as an 'external' FastCGI app. (i.e. the webserver would no longer be responsible for starting your app) If a string, it will be interpreted as a filename and a UNIX socket will be opened. If a tuple, the first element, a string, is the interface name/IP to bind to, and the second element (an int) is the port number. """ BaseFCGIServer.__init__(self, application, environ=environ, multithreaded=multithreaded, multiprocess=multiprocess, bindAddress=bindAddress, umask=umask, multiplexed=multiplexed, debug=debug, roles=roles, forceCGI=forceCGI) for key in ('jobClass', 'jobArgs'): if key in kw: del kw[key] ThreadedServer.__init__(self, jobClass=self._connectionClass, jobArgs=(self,), **kw)
def __init__( self, application, environ=None, bindAddress=None, umask=None, multiplexed=False, debug=False, roles=(FCGI_RESPONDER,), forceCGI=False, timeout=None, **kw ): """ environ, if present, must be a dictionary-like object. Its contents will be copied into application's environ. Useful for passing application-specific variables. bindAddress, if present, must either be a string or a 2-tuple. If present, run() will open its own listening socket. You would use this if you wanted to run your application as an 'external' FastCGI app. (i.e. the webserver would no longer be responsible for starting your app) If a string, it will be interpreted as a filename and a UNIX socket will be opened. If a tuple, the first element, a string, is the interface name/IP to bind to, and the second element (an int) is the port number. """ BaseFCGIServer.__init__( self, application, environ=environ, multithreaded=False, multiprocess=True, bindAddress=bindAddress, umask=umask, multiplexed=multiplexed, debug=debug, roles=roles, forceCGI=forceCGI, ) for key in ("multithreaded", "multiprocess", "jobClass", "jobArgs"): if kw.has_key(key): del kw[key] PreforkServer.__init__(self, jobClass=self._connectionClass, jobArgs=(self, timeout), **kw) try: import resource # Attempt to glean the maximum number of connections # from the OS. try: maxProcs = resource.getrlimit(resource.RLIMIT_NPROC)[0] maxConns = resource.getrlimit(resource.RLIMIT_NOFILE)[0] maxConns = min(maxConns, maxProcs) except AttributeError: maxConns = resource.getrlimit(resource.RLIMIT_NOFILE)[0] except ImportError: maxConns = 100 # Just some made up number. maxReqs = maxConns self.capability = {FCGI_MAX_CONNS: maxConns, FCGI_MAX_REQS: maxReqs, FCGI_MPXS_CONNS: 0}
def __init__(self, application, environ=None, bindAddress=None, umask=None, multiplexed=False, debug=True, **kw): """ environ, if present, must be a dictionary-like object. Its contents will be copied into application's environ. Useful for passing application-specific variables. bindAddress, if present, must either be a string or a 2-tuple. If present, run() will open its own listening socket. You would use this if you wanted to run your application as an 'external' FastCGI app. (i.e. the webserver would no longer be responsible for starting your app) If a string, it will be interpreted as a filename and a UNIX socket will be opened. If a tuple, the first element, a string, is the interface name/IP to bind to, and the second element (an int) is the port number. """ BaseFCGIServer.__init__(self, application, environ=environ, multithreaded=False, multiprocess=True, bindAddress=bindAddress, umask=umask, multiplexed=multiplexed, debug=debug) for key in ('multithreaded', 'multiprocess', 'jobClass', 'jobArgs'): if kw.has_key(key): del kw[key] PreforkServer.__init__(self, jobClass=self._connectionClass, jobArgs=(self, ), **kw) try: import resource # Attempt to glean the maximum number of connections # from the OS. try: maxProcs = resource.getrlimit(resource.RLIMIT_NPROC)[0] maxConns = resource.getrlimit(resource.RLIMIT_NOFILE)[0] maxConns = min(maxConns, maxProcs) except AttributeError: maxConns = resource.getrlimit(resource.RLIMIT_NOFILE)[0] except ImportError: maxConns = 100 # Just some made up number. maxReqs = maxConns self.capability = { FCGI_MAX_CONNS: maxConns, FCGI_MAX_REQS: maxReqs, FCGI_MPXS_CONNS: 0 }