Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71985

WSGI (was: Re: Python CGI)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chris_news@arcor.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'output': 0.05; 'subject:Python': 0.06; 'output,': 0.09; 'received:151': 0.09; 'skip:/ 10': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'apache': 0.15; "'200": 0.16; '00:00:00': 0.16; 'burak': 0.16; 'subject:WSGI': 0.16; 'to:addr:python.list': 0.16; 'to:addr:tim.thechases.com': 0.16; 'to:name:tim chase': 0.16; 'user?': 0.16; 'wrote:': 0.18; 'import': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'script': 0.25; 'define': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'tim': 0.29; "i'm": 0.30; "skip:' 10": 0.31; 'chase': 0.31; 'running': 0.33; 'skip:# 10': 0.33; 'subject: (': 0.35; 'skip:[ 10': 0.38; 'skip:- 60': 0.39; 'tell': 0.60; 'issues,': 0.61
X-Greylist Passed host: 37.201.133.86
X-DKIM Sendmail DKIM Filter v2.8.2 mail-in-03.arcor-online.net 845CDD7F92
DKIM-Signature v=1; a=rsa-sha256; c=simple/simple; d=arcor.de; s=mail-in; t=1401001303; bh=TJ6Oe41IT/NiisarjWL6ottaBRsPgd/oJMKLtgpkHYI=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=iW+ikTM/2diPy4J+ZJeJPGT2RPcsuphcRHGCFSSCaADRGZVigfsEjSX9bN5Uyjiz3 EF6JayNwRWaQmtyfe6dgeApPsLF0vEJZwklLSvWDbMW+t9URBRssq4qdxtMIArHOcf 6cuqtLyD3Mw7E6ahbIxRHUeeCDziZU9RSrygTleE=
X-Greylist Passed host: 37.201.133.86
Date Sun, 25 May 2014 09:01:43 +0200
From Christian <chris_news@arcor.de>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version 1.0
To Tim Chase <python.list@tim.thechases.com>
Subject WSGI (was: Re: Python CGI)
References <btv115Fb0rlU1@mid.individual.net> <20140519205252.264fc764@bigbox.christie.dr>
In-Reply-To <20140519205252.264fc764@bigbox.christie.dr>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.10280.1401003346.18130.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1401003346 news.xs4all.nl 2923 [2001:888:2000:d::a6]:35333
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:71985

Show key headers only | View raw


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@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python CGI Christian <chris_news@arcor.de> - 2014-05-19 20:32 +0200
  Re: Python CGI Burak Arslan <burak.arslan@arskom.com.tr> - 2014-05-19 21:53 +0300
  Re: Python CGI Tim Chase <python.list@tim.thechases.com> - 2014-05-19 20:52 -0500
  WSGI (was: Re: Python CGI) Christian <chris_news@arcor.de> - 2014-05-25 09:01 +0200
  WSGI (was: Re: Python CGI) Chris <ch2009@arcor.de> - 2014-05-25 09:06 +0200
    Re: WSGI (was: Re: Python CGI) alister <alister.nospam.ware@ntlworld.com> - 2014-05-25 10:04 +0000
      Re: WSGI Chris <ch2009@arcor.de> - 2014-05-25 14:22 +0200

csiph-web