| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/flup/server/__pycache__/ |
Upload File : |
�
#H\a� � �� � d Z dZdZddlZddlZddlmZmZmZ ddl m
Z
dgZ G d� dee
� � Ze
d k r?d
� ZddlmZ ej e� � Z eeej �� � � � � dS dS )
a�
scgi - an SCGI/WSGI gateway.
For more information about SCGI and mod_scgi for Apache1/Apache2, see
<http://www.mems-exchange.org/software/scgi/>.
For more information about the Web Server Gateway Interface, see
<http://www.python.org/peps/pep-0333.html>.
Example usage:
#!/usr/bin/env python
import sys
from myapplication import app # Assume app is your WSGI application object
from scgi import WSGIServer
ret = WSGIServer(app).run()
sys.exit(ret and 42 or 0)
See the documentation for WSGIServer for more information.
About the bit of logic at the end:
Upon receiving SIGHUP, the python script will exit with status code 42. This
can be used by a wrapper script to determine if the python script should be
re-run. When a SIGINT or SIGTERM is received, the script exits with status
code 0, possibly indicating a normal exit.
Example wrapper script:
#!/bin/sh
STATUS=42
while test $STATUS -eq 42; do
python "$@" that_script_above.py
STATUS=$?
done
zAllan Saddi <allan@saddi.com>z
$Revision$� N)�BaseSCGIServer�
Connection� NoDefault)�
PreforkServer�
WSGIServerc �8 � e Zd ZdZeddddej dfd�Zd� ZdS )r a
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. ;)
N)� localhosti� Tc
� � t j | |||dd|||||�� � dD ] }
|
| v r| |
= �
t j | ft | fd�| �� dS )a
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.
FT) �
scriptName�environ�
multithreaded�multiprocess�bindAddress�umask�allowedServers�loggingLevel�debug)r
r �jobClass�jobArgs)r r N)r �__init__r r )�self�applicationr r r r r r r �kw�keys �7/usr/lib/python3/dist-packages/flup/server/scgi_fork.pyr zWSGIServer.__init__Z s� � �<