Back to index

moin  1.9.0~rc2
Public Member Functions
MoinMoin.support.flup.server.scgi_fork.WSGIServer Class Reference
Inheritance diagram for MoinMoin.support.flup.server.scgi_fork.WSGIServer:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.support.flup.server.scgi_fork.WSGIServer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def run

Detailed Description

SCGI/WSGI server. For information about SCGI (Simple Common Gateway
Interface), see http://www.mems-exchange.org/software/scgi/.

This server is similar to SWAP http://www.idyll.org/~t/www-tools/wsgi/,
another SCGI/WSGI server.

It differs from SWAP in that it isn't based on scgi.scgi_server and
therefore, it allows me to implement concurrency using threads. (Also,
this server was written from scratch and really has no other depedencies.)
Which server to use really boils down to whether you want multithreading
or forking. (But as an aside, I've found scgi.scgi_server's implementation
of preforking to be quite superior. So if your application really doesn't
mind running in multiple processes, go use SWAP. ;)

Definition at line 81 of file scgi_fork.py.


Constructor & Destructor Documentation

def MoinMoin.support.flup.server.scgi_fork.WSGIServer.__init__ (   self,
  application,
  scriptName = NoDefault,
  environ = None,
  bindAddress = ('localhost', 4000,
  umask = None,
  allowedServers = None,
  loggingLevel = logging.INFO,
  debug = False,
  kw 
)
scriptName is the initial portion of the URL path that "belongs"
to your application. It is used to determine PATH_INFO (which doesn't
seem to be passed in). An empty scriptName means your application
is mounted at the root of your virtual host.

environ, which must be a dictionary, can contain any additional
environment variables you want to pass to your application.

bindAddress is the address to bind to, which must be a string or
a tuple of length 2. If a tuple, the first element must be a string,
which is the host name or IPv4 address of a local interface. The
2nd element of the tuple is the port number. If a string, it will
be interpreted as a filename and a UNIX socket will be opened.

If binding to a UNIX socket, umask may be set to specify what
the umask is to be changed to before the socket is created in the
filesystem. After the socket is created, the previous umask is
restored.

allowedServers must be None or a list of strings representing the
IPv4 addresses of servers allowed to connect. None means accept
connections from anywhere.

loggingLevel sets the logging level of the module-level logger.

Definition at line 100 of file scgi_fork.py.

00100 
00101                  loggingLevel=logging.INFO, debug=False, **kw):
00102         """
00103         scriptName is the initial portion of the URL path that "belongs"
00104         to your application. It is used to determine PATH_INFO (which doesn't
00105         seem to be passed in). An empty scriptName means your application
00106         is mounted at the root of your virtual host.
00107 
00108         environ, which must be a dictionary, can contain any additional
00109         environment variables you want to pass to your application.
00110 
00111         bindAddress is the address to bind to, which must be a string or
00112         a tuple of length 2. If a tuple, the first element must be a string,
00113         which is the host name or IPv4 address of a local interface. The
00114         2nd element of the tuple is the port number. If a string, it will
00115         be interpreted as a filename and a UNIX socket will be opened.
00116 
00117         If binding to a UNIX socket, umask may be set to specify what
00118         the umask is to be changed to before the socket is created in the
00119         filesystem. After the socket is created, the previous umask is
00120         restored.
00121 
00122         allowedServers must be None or a list of strings representing the
00123         IPv4 addresses of servers allowed to connect. None means accept
00124         connections from anywhere.
00125 
00126         loggingLevel sets the logging level of the module-level logger.
00127         """
00128         BaseSCGIServer.__init__(self, application,
00129                                 scriptName=scriptName,
00130                                 environ=environ,
00131                                 multithreaded=False,
00132                                 multiprocess=True,
00133                                 bindAddress=bindAddress,
00134                                 umask=umask,
00135                                 allowedServers=allowedServers,
00136                                 loggingLevel=loggingLevel,
00137                                 debug=debug)
00138         for key in ('multithreaded', 'multiprocess', 'jobClass', 'jobArgs'):
00139             if kw.has_key(key):
00140                 del kw[key]
00141         PreforkServer.__init__(self, jobClass=Connection, jobArgs=(self,), **kw)


Member Function Documentation

Main loop. Call this after instantiating WSGIServer. SIGHUP, SIGINT,
SIGQUIT, SIGTERM cause it to cleanup and return. (If a SIGHUP
is caught, this method returns True. Returns False otherwise.)

Definition at line 142 of file scgi_fork.py.

00142 
00143     def run(self):
00144         """
00145         Main loop. Call this after instantiating WSGIServer. SIGHUP, SIGINT,
00146         SIGQUIT, SIGTERM cause it to cleanup and return. (If a SIGHUP
00147         is caught, this method returns True. Returns False otherwise.)
00148         """
00149         self.logger.info('%s starting up', self.__class__.__name__)
00150 
00151         try:
00152             sock = self._setupSocket()
00153         except socket.error, e:
00154             self.logger.error('Failed to bind socket (%s), exiting', e[1])
00155             return False
00156 
00157         ret = PreforkServer.run(self, sock)
00158 
00159         self._cleanupSocket(sock)
00160 
00161         self.logger.info('%s shutting down%s', self.__class__.__name__,
00162                          self._hupReceived and ' (reload requested)' or '')
00163 
00164         return ret

Here is the call graph for this function:


The documentation for this class was generated from the following file: