I have been experimenting with my very own webserver (Apache+Ubuntu) and python. From what I have seen you will find 3(?) primary methods for carrying this out:

  1. Apache set up to deal with .py as cgi
  2. Apache set up to make use of mod_python that's now outdated(?)
  3. Apache set up to make use of mod_wsgi

From the reading through that Django favors mod_wsgi, and I am kinda thinking about learning Django (I have heard their official tutorial is quite excellent).

What's the 'recommended' setup? I presume there is no reason to make use of mod_python any longer, but do you know the variations between handling .py as cgi, and mod_wsgi? Can you really run them together (and would you need to?), or perhaps is that simply a absurd idea and that i should stop thinking such crazy things?

I suppose really I am just searching for a primer on Apache+Python (links will also be good) - nothing I have run into to date continues to be terribly informative - these were mainly precisely how-to's.

mod_python is dead, so using mod_python most likely is not advisable for brand new projects. Personally, I favor to make use of mod_wsgi over CGI (or FastCGI). It's dead-simple to setup, plus much more efficient.

  1. Avoid using CGI. It's inefficient. Breeding a brand new process for every request. No thanks

  2. Dont't spend enough time with mod_python

  3. Use mod_wsgi.

If you wish to write CGI-like stuff with no framework, use mod_wsgi anyway. The WSGI standard (PEP 333) is important for creating web programs within an easy, interchangeable, multiple-use, plug-and-playable way.

I'd opt for mod_wsgi too.

If you prefer a much deeper understanding concerning the question, take a look only at that: