WSGI (was: Re: Python CGI)
Christian
chris_news at arcor.de
Sun May 25 03:01:43 EDT 2014
On 05/20/2014 03:52 AM, Tim Chase wrote:
> While Burak addressed your (Fast-)CGI issues, once you have a
> test-script successfully giving you output, you can use the
> standard-library's getpass.getuser() function to tell who your script
> is running as.
LoadModule wsgi_module modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
WSGIDaemonProcess myproj user=chris threads=3
[root at t-centos1 ~]# ps -ef|grep chris
chris 1201 1199 0 08:47 ? 00:00:00 /usr/sbin/httpd
-------------------------------------------------------8<-------
#!/usr/bin/python
import getpass
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
output += getpass.getuser()
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
------------------------------------------------------->8-------
Hello World!root
Hmm, why is it root?
I'm using Apache and mod_userdir. Can I define WSGIDaemonProcess for
each user?
- Chris
More information about the Python-list
mailing list