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


Groups > comp.lang.python > #73653

Re: Execute a python script with CGI ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <laurent.celati@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'postgresql': 0.07; 'http': 0.09; 'indexes': 0.09; 'subject:script': 0.09; 'python': 0.11; 'archive': 0.14; 'apache': 0.15; 'windows': 0.15; '.py': 0.16; '2.2,': 0.16; 'context:': 0.16; 'script,': 0.16; 'throw': 0.16; 'world!")': 0.16; 'subject:python': 0.16; 'subject: ?': 0.16; 'all,': 0.19; 'thanks.': 0.20; 'import': 0.22; 'script.': 0.24; 'server.': 0.24; 'options': 0.25; 'script': 0.25; 'post': 0.26; '(for': 0.26; 'header:In-Reply-To:1': 0.27; 'installed': 0.27; 'lines': 0.31; 'cgi': 0.31; 'coded': 0.31; 'file': 0.32; 'me?': 0.32; 'linux': 0.33; 'url:python': 0.33; 'could': 0.34; 'subject:with': 0.35; 'created': 0.35; 'test': 0.35; 'but': 0.35; 'list': 0.37; 'remote': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'mailing': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'ensure': 0.60; '2nd': 0.60; 'our': 0.64; 'more': 0.64; 'dear': 0.65; 'regards.': 0.65; '(web': 0.84; '2.7.': 0.84; 'avant': 0.91
Date Fri, 27 Jun 2014 03:26:24 -0700 (PDT)
From dandrigo <laurent.celati@gmail.com>
To python-list@python.org
In-Reply-To <1403796296902-5062183.post@n6.nabble.com>
References <1403796296902-5062183.post@n6.nabble.com>
Subject Re: Execute a python script with CGI ?
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
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.11278.1403864817.18130.python-list@python.org> (permalink)
Lines 73
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1403864817 news.xs4all.nl 2947 [2001:888:2000:d::a6]:34765
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73653

Show key headers only | View raw


Dear all,

1/ On my windows 8, i installed apache 2.2, python 2.7.

I coded a python script. I would like to execute this python script in CGI.I
would like enable GET pattern only (no POST pattern).  

Up to now : 

*i edited these following lines of my apache httpd.conf:
----------------------------------------------------------------------------------
DocumentRoot "C:\Program Files (x86)\Apache Software
Foundation\Apache2.2\cgi-bin"
<Directory "C:/Program Files (x86)/Apache Software
Foundation/Apache2.2/cgi-bin/">
AddHandler cgi-script .cgi .py
--------------------------------------------------------------------------------

 
*i created a htacess.txt and i pasted it into the file these following lines
:
--------------------------------------------------------------------------------
# Interprétation des fichiers .py avant envoi au serveur HTTP
AddHandler cgi-script .py
Options +ExecCGI

# Fichiers index.py : indexes repertoires
DirectoryIndex index.py
--------------------------------------------------------------------------------
  
* Si i writed a python script (web service with postgresql query). At the
begining of my script, i added these folloging lines :
--------------------------------------------------------------------------------
import cgitb

cgitb.enable()

print("Content-Type: text/html;charset=utf-8")
print()
print("Hello World!")
--------------------------------------------------------------------------------

=> What do you think about my configuration? I have made ​​a mistake? I do
have one more thing? How to test our CGI? our to ensure that my cgi works
well? 
I would like enable GET pattern only (no POST pattern). 

2/ On a 2nd time, i would like to do the same operation (for the same python
script web service/ GET pattern) but on our remote LINUX server.

=> What is the difference beetween windows and linux configuration? Could
you throw light for me? 

Thanks. 

Regards. 



--
View this message in context: http://python.6.x6.nabble.com/Execute-a-python-script-with-CGI-tp5062183p5062268.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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


Thread

Re: Execute a python script with CGI ? dandrigo <laurent.celati@gmail.com> - 2014-06-27 03:26 -0700

csiph-web