[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
BeginnersGuideToPython_CGI

Begginer's Guide to Python, CGI

Python is an excellent language for writing CGI scripts. All of the examples here will assume you have the Apache http server running on a UNIX/Linux/cygwin system. If you are using a different http server or operating system, consult the documentation that came with that system for instructions on running CGI scripts.

Your first Python CGI script

Writing a CGI script in Python is exceedingly easy. Here is an example:
  1. !/usr/bin/python
print "Content-type: text/plain\n" print "Hello, CGI world!"
This example assumes your Python interpreter is located in /usr/bin. Change this to reflect your system. Save this example as a text file in your cgi-bin directory (/var/www/cgi-bin on my system). To run your script and see the output, just point your browser to "[your domain name]/cgi-bin/plain.py".

last edited (December 30, 2002) by infidel, Number of views: 5866, Current Rev: 5 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.