Loading AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ answer newbie questions, and generally made Django that much better: Sengtha Chay <sengtha@e-khmer.com> ivan.chelubeev@gmail.com Bryan Chow <bryan at verdjn dot com> Antonis Christofides <anthony@itia.ntua.gr> Michal Chruszcz <troll@pld-linux.org> Can Burak Çilingir <canburak@cs.bilgi.edu.tr> Ian Clelland <clelland@gmail.com> Loading django/core/servers/fastcgi.py +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ Optional Fcgi settings: (setting=value) workdir=DIRECTORY change to this directory when daemonizing. outlog=FILE write stdout to this file. errlog=FILE write stderr to this file. umask=UMASK umask to use when daemonizing (default 022). Examples: Run a "standard" fastcgi process on a file-descriptor Loading Loading @@ -73,6 +74,7 @@ FASTCGI_OPTIONS = { 'maxrequests': 0, 'outlog': None, 'errlog': None, 'umask': None, } def fastcgi_help(message=None): Loading Loading @@ -159,6 +161,8 @@ def runfastcgi(argset=[], **kwargs): daemon_kwargs['out_log'] = options['outlog'] if options['errlog']: daemon_kwargs['err_log'] = options['errlog'] if options['umask']: daemon_kwargs['umask'] = int(options['umask']) if daemonize: from django.utils.daemonize import become_daemon Loading django/utils/daemonize.py +5 −4 Original line number Diff line number Diff line Loading @@ -2,7 +2,8 @@ import os import sys if os.name == 'posix': def become_daemon(our_home_dir='.', out_log='/dev/null', err_log='/dev/null'): def become_daemon(our_home_dir='.', out_log='/dev/null', err_log='/dev/null', umask=022): "Robustly turn into a UNIX daemon, running in our_home_dir." # First fork try: Loading @@ -13,7 +14,7 @@ if os.name == 'posix': sys.exit(1) os.setsid() os.chdir(our_home_dir) os.umask(0) os.umask(umask) # Second fork try: Loading @@ -32,13 +33,13 @@ if os.name == 'posix': # 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): def become_daemon(our_home_dir='.', out_log=None, err_log=None, umask=022): """ If we're not running under a POSIX system, just simulate the daemon mode by doing redirections and directory changing. """ os.chdir(our_home_dir) os.umask(0) os.umask(umask) sys.stdin.close() sys.stdout.close() sys.stderr.close() Loading Loading
AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ answer newbie questions, and generally made Django that much better: Sengtha Chay <sengtha@e-khmer.com> ivan.chelubeev@gmail.com Bryan Chow <bryan at verdjn dot com> Antonis Christofides <anthony@itia.ntua.gr> Michal Chruszcz <troll@pld-linux.org> Can Burak Çilingir <canburak@cs.bilgi.edu.tr> Ian Clelland <clelland@gmail.com> Loading
django/core/servers/fastcgi.py +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ Optional Fcgi settings: (setting=value) workdir=DIRECTORY change to this directory when daemonizing. outlog=FILE write stdout to this file. errlog=FILE write stderr to this file. umask=UMASK umask to use when daemonizing (default 022). Examples: Run a "standard" fastcgi process on a file-descriptor Loading Loading @@ -73,6 +74,7 @@ FASTCGI_OPTIONS = { 'maxrequests': 0, 'outlog': None, 'errlog': None, 'umask': None, } def fastcgi_help(message=None): Loading Loading @@ -159,6 +161,8 @@ def runfastcgi(argset=[], **kwargs): daemon_kwargs['out_log'] = options['outlog'] if options['errlog']: daemon_kwargs['err_log'] = options['errlog'] if options['umask']: daemon_kwargs['umask'] = int(options['umask']) if daemonize: from django.utils.daemonize import become_daemon Loading
django/utils/daemonize.py +5 −4 Original line number Diff line number Diff line Loading @@ -2,7 +2,8 @@ import os import sys if os.name == 'posix': def become_daemon(our_home_dir='.', out_log='/dev/null', err_log='/dev/null'): def become_daemon(our_home_dir='.', out_log='/dev/null', err_log='/dev/null', umask=022): "Robustly turn into a UNIX daemon, running in our_home_dir." # First fork try: Loading @@ -13,7 +14,7 @@ if os.name == 'posix': sys.exit(1) os.setsid() os.chdir(our_home_dir) os.umask(0) os.umask(umask) # Second fork try: Loading @@ -32,13 +33,13 @@ if os.name == 'posix': # 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): def become_daemon(our_home_dir='.', out_log=None, err_log=None, umask=022): """ If we're not running under a POSIX system, just simulate the daemon mode by doing redirections and directory changing. """ os.chdir(our_home_dir) os.umask(0) os.umask(umask) sys.stdin.close() sys.stdout.close() sys.stderr.close() Loading