Added support for SCGI and AJP. This is a piece that was missed in [4897]. Refs
#3047. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4902 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d882656ea3
commit
70c4a88e82
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
FastCGI server that implements the WSGI protocol.
|
||||
FastCGI (or SCGI, or AJP1.3 ...) server that implements the WSGI protocol.
|
||||
|
||||
Uses the flup python package: http://www.saddi.com/software/flup/
|
||||
|
||||
|
@ -18,15 +18,16 @@ __version__ = "0.1"
|
|||
__all__ = ["runfastcgi"]
|
||||
|
||||
FASTCGI_HELP = r"""runfcgi:
|
||||
Run this project as a fastcgi application. To do this, the
|
||||
flup package from http://www.saddi.com/software/flup/ is
|
||||
required.
|
||||
Run this project as a fastcgi (or some other protocol supported
|
||||
by flup) application. To do this, the flup package from
|
||||
http://www.saddi.com/software/flup/ is required.
|
||||
|
||||
Usage:
|
||||
django-admin.py runfcgi --settings=yourproject.settings [fcgi settings]
|
||||
manage.py runfcgi [fcgi settings]
|
||||
|
||||
Optional Fcgi settings: (setting=value)
|
||||
protocol=PROTOCOL fcgi, scgi, ajp, ... (default fcgi)
|
||||
host=HOSTNAME hostname to listen on..
|
||||
port=PORTNUM port to listen on.
|
||||
socket=FILE UNIX socket to listen on.
|
||||
|
@ -45,8 +46,8 @@ Examples:
|
|||
(for webservers which spawn your processes for you)
|
||||
$ manage.py runfcgi method=threaded
|
||||
|
||||
Run a fastcgi server on a TCP host/port
|
||||
$ manage.py runfcgi method=prefork host=127.0.0.1 port=8025
|
||||
Run a scgi server on a TCP host/port
|
||||
$ manage.py runfcgi protocol=scgi method=prefork host=127.0.0.1 port=8025
|
||||
|
||||
Run a fastcgi server on a UNIX domain socket (posix platforms only)
|
||||
$ manage.py runfcgi method=prefork socket=/tmp/fcgi.sock
|
||||
|
@ -58,6 +59,7 @@ Examples:
|
|||
"""
|
||||
|
||||
FASTCGI_OPTIONS = {
|
||||
'protocol': 'fcgi',
|
||||
'host': None,
|
||||
'port': None,
|
||||
'socket': None,
|
||||
|
@ -100,16 +102,17 @@ def runfastcgi(argset=[], **kwargs):
|
|||
print >> sys.stderr, " installed flup, then make sure you have it in your PYTHONPATH."
|
||||
return False
|
||||
|
||||
flup_module = 'server.' + options['protocol']
|
||||
|
||||
if options['method'] in ('prefork', 'fork'):
|
||||
from flup.server.fcgi_fork import WSGIServer
|
||||
wsgi_opts = {
|
||||
'maxSpare': int(options["maxspare"]),
|
||||
'minSpare': int(options["minspare"]),
|
||||
'maxChildren': int(options["maxchildren"]),
|
||||
'maxRequests': int(options["maxrequests"]),
|
||||
}
|
||||
flup_module += '_fork'
|
||||
elif options['method'] in ('thread', 'threaded'):
|
||||
from flup.server.fcgi import WSGIServer
|
||||
wsgi_opts = {
|
||||
'maxSpare': int(options["maxspare"]),
|
||||
'minSpare': int(options["minspare"]),
|
||||
|
@ -120,6 +123,12 @@ def runfastcgi(argset=[], **kwargs):
|
|||
|
||||
wsgi_opts['debug'] = False # Turn off flup tracebacks
|
||||
|
||||
try:
|
||||
WSGIServer = getattr(__import__('flup.' + flup_module, '', '', flup_module), 'WSGIServer')
|
||||
except:
|
||||
print "Can't import flup." + flup_module
|
||||
return False
|
||||
|
||||
# Prep up and go
|
||||
from django.core.handlers.wsgi import WSGIHandler
|
||||
|
||||
|
|
Loading…
Reference in New Issue