Execute a python script with CGI ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx






[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux