开发者

set process name in mod_wsgi

开发者 https://www.devze.com 2023-01-07 04:13 出处:网络
I\'m running a site by apache2.x with mod_wsgi 2.5, and python2.5. It is configured to run in multi-processes and each process only contains one thread.

I'm running a site by apache2.x with mod_wsgi 2.5, and python2.5. It is configured to run in multi-processes and each process only contains one thread.

When I read this post, I try to set the process name to PATH_INFO, but it doesn't work. My code is like:

import ctypes
libc = ctypes.CDLL('/lib/libc.so.6')
def application (environ, start_respon开发者_高级运维se):
   libc.prctl(15, environ.get('PATH_INFO', 'WSGI'), 0, 0, 0);
   # other codes


If you are using mod_wsgi daemon mode, is there anything wrong with the display-name option to WSGIDaemonProcess. That option is precisely for changing the name of the process to a fixed value using setproctitle() or argv[0] assignment as believed works for specific platforms. See:

http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess

Note that it only makes sense to do this for daemon mode processes and not the Apache server processes themselves. Thus why is only available for WSGIDaemonProcess directive. It only makes sense to set it once on process start as well and not dynamically based on request.

0

精彩评论

暂无评论...
验证码 换一张
取 消