summaryrefslogtreecommitdiff
path: root/paste
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-05-14 17:48:22 +0000
committerianb <devnull@localhost>2005-05-14 17:48:22 +0000
commit7bbc59af44b874a27c44a4e536fcc8b113c2b990 (patch)
treea8101d88c5c3d8397e89a6f5c5c7138d25026392 /paste
parentdd5e01f4197bef3e5a1c6220662bf6d469064d6a (diff)
downloadpaste-7bbc59af44b874a27c44a4e536fcc8b113c2b990.tar.gz
Added FastCGI
Diffstat (limited to 'paste')
-rw-r--r--paste/servers/fastcgi_fork_server.py11
-rw-r--r--paste/servers/fastcgi_threaded_server.py39
2 files changed, 50 insertions, 0 deletions
diff --git a/paste/servers/fastcgi_fork_server.py b/paste/servers/fastcgi_fork_server.py
new file mode 100644
index 0000000..8d059af
--- /dev/null
+++ b/paste/servers/fastcgi_fork_server.py
@@ -0,0 +1,11 @@
+from fastcgi_threaded_server import *
+
+def serve(conf, app):
+ from flup.server.fcgi_fork import WSGIServer
+ return serve_server(conf, app, WSGIServer)
+
+description = """\
+A FastCGI forking (multiprocess) server. For more information on
+FastCGI see <http://www.fastcgi.com>. This server is from flup:
+<http://www.saddi.com/software/flup/>.
+"""
diff --git a/paste/servers/fastcgi_threaded_server.py b/paste/servers/fastcgi_threaded_server.py
new file mode 100644
index 0000000..ae3a797
--- /dev/null
+++ b/paste/servers/fastcgi_threaded_server.py
@@ -0,0 +1,39 @@
+import os
+from paste.util import thirdparty
+thirdparty.add_package('flup')
+from paste import pyconfig
+
+def serve(conf, app):
+ from flup.server.fcgi import WSGIServer
+ return serve_server(conf, app, WSGIServer)
+
+def serve_server(conf, app, server_class):
+ if conf.get('host'):
+ if not conf.get('port'):
+ raise ValueError(
+ "There is no default port for FastCGI; if you give 'host' you must provide 'port'")
+ address = (conf['host'], conf['port'])
+ elif conf.get('socket'):
+ address = conf['socket']
+ else:
+ address = os.path.join(conf.get('root_path', ''), 'fcgi_sock')
+ # @@: Right now there's no automatic socket, and the parent server
+ # can't start up this server in any way.
+ server = server_class(
+ app,
+ bindAddress=address,
+ multiplexed=pyconfig.make_bool(conf.get('multiplexed', False)))
+ return server.run()
+
+options = [
+ ('socket', 'The filename of a socket to listen to for connections. Default is fcgi_sock in the current directory.'),
+ ('host', 'The host to bind to when listening for connections over the network. You must also provide port if you provide host.'),
+ ('port', 'The port to bind to.'),
+ ('multiplex', 'Option to multiplex connections (default: false).'),
+ ]
+
+description = """\
+A FastCGI threaded server. For more information on FastCGI see
+<http://www.fastcgi.com>. This server is from flup:
+<http://www.saddi.com/software/flup/>.
+"""