There are two main ways of running Python on Apache. The simplest would be to use CGI and write normal Python scripts while the second is using a web framework like Django or Pylons.
Using CGI is straightforward. Make sure your Apache config file has a cgi-bin set up. If not, follow their documentation (http://httpd.apache.org/docs/2.0/howto/cgi.html). At that point all you need to do is place your Python scripts in the cgi-bin directory and the standard output will become the HTTP response. Refer to Python’s documentation for further info (https://docs.python.org/library/cgi.html).
If you want to use a web framework you’ll need to setup mod_python or FastCGI. These steps are dependent on which framework you want to use. Django provides clear instructions on how to setup mod_python and Django with Apache (http://www.djangoproject.com/documentation/modpython/)
Yes, mod_python is pretty confusing to set up. Here’s how I did it.
LoadModule python_module modules/mod_python.so <Directory "/serverbase/htdocs/myapp"> AddHandler mod_python .py PythonHandler myapp PythonDebug On
and in your application directory:
$ /serverbase/htdocs/myapp$ ls -l total 16 -r-xr-xr-x 1 root sys 6484 May 21 15:54 myapp.py
Repeat the configuration for each python program you wish to have running under mod_python.
Are you running Python on UNIX or Windows?
An alternative to mod_python and FastCGI is mod_wsgi. You can find out more at modwsgi
I have built and installed this on Solaris without problems. I had previously tried mod_python but ran into problems with shared libraries as part of the build. There are good install docs available.