Writing a simple python web app

Shane Hathaway shane at hathawaymix.org
Sun Sep 12 02:04:30 MDT 2010

On 09/11/2010 03:40 PM, Dave Smith wrote:
> I'm creating a very simple web application, and I want to use python.
> My first guess was that mod_python would provide the easiest entry
> point. Boy, was I wrong. All the mod_python tutorials spend 80% of
> their time extolling the virtues of mod_python over CGI, but they are
> quite lean on specific examples. It's quite disappointing.  A natural
> progression then leads me to mod_wsgi, and since that has equally
> poor documentation, to Django. However, Django is overkill for my app
> (I don't even have a database).

FWIW, mod_python would be a dead end.  mod_wsgi replaces it.  WSGI sits 
at about the same layer as CGI, except that WSGI is a better fit for Python.

> What I want is something as simple as PHP.  Just let me drop my files
> in and start editing. I don't want to have to add some configuration
> directive to httpd.conf for every new file or directory in my web
> app. I really want to use python for this. I'd be open to
> alternatives, like PHP, but PHP's YAML support is junk (tried several
> libraries already, and they all fail to correctly parse the YAML that
> some other python code produces).

It sounds like you have a specific, simple application in mind.  I suggest:

1. Google App Engine.  I haven't used it myself, but I understand it's 
easy to get started.

2. Configure mod_wsgi so that Apache interprets any .wsgi file as a 
Python WSGI app.  That way, you get pretty close to PHP's programming 
model.  Once you have mod_wsgi installed, it might be enough to add this 
directive to Apache:

AddHandler wsgi-script .wsgi

Then each script should have a WSGI app named "application".

3. Try repoze.bfg.  It has great documentation and it makes no 
assumptions about your database like GAE and Django.  I prefer BFG 
because it's a productive high level framework that lets me change the 
lower layers as needed.  Getting started is more work than the PHP 
equivalent, but the authors lead you through it quite well:



More information about the PLUG mailing list