Kaydet (Commit) a752a3d4 authored tarafından Jacob Kaplan-Moss's avatar Jacob Kaplan-Moss

Fixed #6687: added outlog/errlog options to runfcgi. Thanks, tamas.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst f0dec08c
......@@ -37,7 +37,9 @@ Optional Fcgi settings: (setting=value)
maxchildren=NUMBER hard limit number of processes / threads
daemonize=BOOL whether to detach from terminal.
pidfile=FILE write the spawned process-id to this file.
workdir=DIRECTORY change to this directory when daemonizing
workdir=DIRECTORY change to this directory when daemonizing.
outlog=FILE write stdout to this file.
errlog=FILE write stderr to this file.
Examples:
Run a "standard" fastcgi process on a file-descriptor
......@@ -69,6 +71,8 @@ FASTCGI_OPTIONS = {
'minspare': 2,
'maxchildren': 50,
'maxrequests': 0,
'outlog': None,
'errlog': None,
}
def fastcgi_help(message=None):
......@@ -150,9 +154,15 @@ def runfastcgi(argset=[], **kwargs):
else:
return fastcgi_help("ERROR: Invalid option for daemonize parameter.")
daemon_kwargs = {}
if options['outlog']:
daemon_kwargs['out_log'] = options['outlog']
if options['errlog']:
daemon_kwargs['err_log'] = options['errlog']
if daemonize:
from django.utils.daemonize import become_daemon
become_daemon(our_home_dir=options["workdir"])
become_daemon(our_home_dir=options["workdir"], **daemon_kwargs)
if options["pidfile"]:
fp = open(options["pidfile"], "w")
......
......@@ -29,6 +29,8 @@ if os.name == 'posix':
os.dup2(si.fileno(), sys.stdin.fileno())
os.dup2(so.fileno(), sys.stdout.fileno())
os.dup2(se.fileno(), sys.stderr.fileno())
# Set custom file descriptors so that they get proper buffering.
sys.stdout, sys.stderr = so, se
else:
def become_daemon(our_home_dir='.', out_log=None, err_log=None):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment