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


Groups > comp.lang.python > #71772 > unrolled thread

Python CGI

Started byChristian <chris_news@arcor.de>
First post2014-05-19 20:32 +0200
Last post2014-05-25 14:22 +0200
Articles 7 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  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

#71772 — Python CGI

FromChristian <chris_news@arcor.de>
Date2014-05-19 20:32 +0200
SubjectPython CGI
Message-ID<btv115Fb0rlU1@mid.individual.net>
Hi,

I'd like to use Python for CGI-Scripts. Is there a manual how to setup
Python with Fast-CGI? I'd like to make sure that Python scripts aren't
executed by www-user, but the user who wrote the script.

-- 
Gruß,
Christian

[toc] | [next] | [standalone]


#71773

FromBurak Arslan <burak.arslan@arskom.com.tr>
Date2014-05-19 21:53 +0300
Message-ID<mailman.10140.1400525595.18130.python-list@python.org>
In reply to#71772
On 05/19/14 21:32, Christian wrote:
> Hi,
>
> I'd like to use Python for CGI-Scripts. Is there a manual how to setup
> Python with Fast-CGI?

Look for Mailman fastcgi guides.

Here's one for gentoo, but I imagine it'd be easily applicable to other
disros:
https://www.rfc1149.net/blog/2010/12/30/configuring-mailman-with-nginx-on-gentoo/

hth,
burak

[toc] | [prev] | [next] | [standalone]


#71784

FromTim Chase <python.list@tim.thechases.com>
Date2014-05-19 20:52 -0500
Message-ID<mailman.10147.1400550799.18130.python-list@python.org>
In reply to#71772
On 2014-05-19 20:32, Christian wrote:
> I'd like to use Python for CGI-Scripts. Is there a manual how to
> setup Python with Fast-CGI? I'd like to make sure that Python
> scripts aren't executed by www-user, but the user who wrote the
> script.

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.

-tkc

[toc] | [prev] | [next] | [standalone]


#71985 — WSGI (was: Re: Python CGI)

FromChristian <chris_news@arcor.de>
Date2014-05-25 09:01 +0200
SubjectWSGI (was: Re: Python CGI)
Message-ID<mailman.10280.1401003346.18130.python-list@python.org>
In reply to#71772
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

[toc] | [prev] | [next] | [standalone]


#71988 — WSGI (was: Re: Python CGI)

FromChris <ch2009@arcor.de>
Date2014-05-25 09:06 +0200
SubjectWSGI (was: Re: Python CGI)
Message-ID<mailman.10281.1401005873.18130.python-list@python.org>
In reply to#71772
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

-- 
Gruß,
Christian

[toc] | [prev] | [next] | [standalone]


#71994 — Re: WSGI (was: Re: Python CGI)

Fromalister <alister.nospam.ware@ntlworld.com>
Date2014-05-25 10:04 +0000
SubjectRe: WSGI (was: Re: Python CGI)
Message-ID<pejgv.154404$hK2.6465@fx04.am4>
In reply to#71988
On Sun, 25 May 2014 09:06:18 +0200, Chris wrote:

> 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

is your apache server running as root?
if so it probably should be corrected


-- 
Why is it taking so long for her to bring out all the good in you?

[toc] | [prev] | [next] | [standalone]


#72027 — Re: WSGI

FromChris <ch2009@arcor.de>
Date2014-05-25 14:22 +0200
SubjectRe: WSGI
Message-ID<mailman.10309.1401043815.18130.python-list@python.org>
In reply to#71994
On 05/25/2014 12:04 PM, alister wrote:
> is your apache server running as root?
> if so it probably should be corrected

One is running as chris, the others as apache:

[root@t-centos1 ~]# ps -ef|grep httpd
root      1199     1  0 08:47 ?        00:00:01 /usr/sbin/httpd
chris     1293  1199  0 09:47 ?        00:00:00 /usr/sbin/httpd
apache    1294  1199  0 09:47 ?        00:00:00 /usr/sbin/httpd
apache    1295  1199  0 09:47 ?        00:00:00 /usr/sbin/httpd
apache    1296  1199  0 09:47 ?        00:00:00 /usr/sbin/httpd
apache    1297  1199  0 09:47 ?        00:00:00 /usr/sbin/httpd
apache    1298  1199  0 09:47 ?        00:00:00 /usr/sbin/httpd
apache    1299  1199  0 09:47 ?        00:00:00 /usr/sbin/httpd
apache    1300  1199  0 09:47 ?        00:00:00 /usr/sbin/httpd
apache    1301  1199  0 09:47 ?        00:00:00 /usr/sbin/httpd
root      1578  1566  0 14:21 pts/0    00:00:00 grep httpd


-- 
Gruß,
Christian

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web