Running Python

Python is a programming language that has many useful applications when applied to web page development. I want to use it to develop a web-based interface to my data-logging application.

Configuring Apache for Python

Apache has to be configured to use Python as a handler for CGI scripts. This is done by setting up the <Directory> directive for CGI scripts (found in the file ) to read as follows:

<Directory /usr/lib/cgi-bin> AddHandler cgi-script .py Options +ExecCGI </Directory>

Python will now be invoked to handle CGI scripts ending in .py. These scripts must reside in the directory /usr/lib/cgi-bin, although a web page will call this script directly with:

http://www.myserver.net/cgi-bin/script.py


Home: labs.one-wolf.net