FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

A Simple Python Dynamic Page

 


deepak
Hello friends,

I saw some fanastic people about python as web application. Here is a example to use Python as CGI

lizzie.py?data=param
Code:

#!/usr/bin/python
print "Content-Type: text/html\n\n"
import cgi form = cgi.FieldStorage()
strBlah = form["data"].value
print """ Lizzie Loves %s  """ % strBlah.replace( '"', '\\"')


just copy and paste this code, put it in your cgi-bin change appropiate permission.CHANGE CHMOD 777(if you dont know about CHMOD).

Happy Python Programming
Antoine_935
it should be
Content-Type: text/html\r\n
\r\n

the first \r\n is single's header end, the second is all headers's end
eznet
I can get simple python scripts running via CGI but am having troubles with slightly more complex scripts (although still basic).

To avoid poor posting etiquette (although I am not sure this does it Laughing ) I will direct you to my previous post - the code and question are the 2nd post under this thread.

Thanks for any help in advance!
deepak
Antoine_935 wrote:
it should be
Content-Type: text/html\r\n
\r\n

the first \r\n is single's header end, the second is all headers's end


Antoine \r\n is endline for window machines .. \n also works fine with all POSIX OS.

eznet check out your topic, I've solved your problem Very Happy
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.