FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Tutorial needed for python cgi





manoj2593
Is there a tutorial for python cgi programming??..because in my server the normal python cgi is not working i.e
#!/usr/bin/env python
import cgi
print "Content-Type: text/html"
print
print """\
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
"""
This code is not working!
But this code is working
def index(req):
return """<html>
<head>
<title>Hello Word - First CGI Program</title>
</head>
<body>
<h2>Hello Word! This is my first CGI program</h2>
</body>
</html>"""
What to do???
ibraltan1
Indeed I do not know Python but as I was trying to find a solution to your problem I came across some knowledge sources that can be helpful, such as
http://webpython.codepoint.net/cgi_tutorial
http://www.tutorialspoint.com/python/python_cgi_programming.htm
https://wiki.python.org/moin/CgiScripts
https://docs.python.org/3/library/cgi.html

By the way, the answer of the question “Is it worth spending time and effort to learn it?” seems to be “Yes”. Python is an interactive, general-purpose interpreted, object-oriented and high-level programming language. It was created by Guido van Rossum during the late eighties and early nineties. Like Perl, Python source code is also now readily obtainable under the GNU General Public License (GPL). It was designed to be highly readable which uses English keywords oftentimes where as other programming languages use punctuation and it has fewer syntactical structure than other programming languages. It is a super language for the beginner programmers and supports the elaboration of an extensive range of applications from easy text processing to www browsers to games. Main aspects of it are easy-to-learn, easy-to-read, easy-to-maintain, a broad standard library, having an interactive mode, portable, extendable.
marcorele
Thank you for the links! very usefull
amagard
After a first view into your initial script I don't see a reason why it shouldn't work, except the first line. I am using
Code:
#!/usr/bin/python

in my scripts to properly invoke Python.
Nevertheless, I tried your code and it does work for me, see here.
Related topics
Complete Tutorial LINKS for every language
Help Needed Regarding CGI And Php
Is there a tutorial for CGI-scripts?
Does frihost still support Python for CGI programming
Python beginners help!
Python CGI work with FRIHOST
Problem with python cgi - does Python CGI work?
Python support for MySQL
Python via CGI - A personal triumph
Python via CGI - A personal triumph
How to debug Python CGI errors
Python, CGI and CSS
Python CGI script 500 error
How to check whether a Python module is installed
Reply to topic    Frihost Forum Index -> Scripting -> Others

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