Archive for June, 2008

Building a Python Web Application, Part 1

Thursday, June 26th, 2008
Edit: I’ve cleaned up the longer example, using Python’s string.Template module for the templates. I’ve also set up a git repo for the source that will go along with posts to this series: Python Webapp Gitweb

Recently, I’ve been interested in writing web applications in Python, and one of the fun things that I discovered was the Python Web Server Gateway Interface, which is a standard interface for Python web servers, web applications, and something called middleware which can sit between the two.

One of the coolest things about WSGI is the fact that you now don’t have to decide on a specific web server before you start coding. In fact, the Python wsgiref module comes with a built-in simple web server which allows you to start coding up your web application with nothing but a bare install of Python 2.5 (or higher, of course)!

There are plenty of overviews of WSGI out there, so I won’t bother creating yet another in-depth explanation. What I will do, though, is show you how easy it is to get started.

Your basic “Hello, World!” application can be accomplished, server and all, with as little as the following:

(more…)

CouchDB looks Awesome, my Slug is borked

Tuesday, June 24th, 2008

In lieu of a real blog post, and as a way to break the 3-week silence that has recently hung over this blog, I’d just like to say this:

I’ve been looking at CouchDB, and it looks awesome.

For those who don’t know, CouchDB is a RESTful, distributed, schema-free, document-oriented database.

It looks like it’s the answer to all those times when I was thinking to myself “Man, this really doesn’t need a relational database, it needs…something else.”

Well, from what I’ve seen so far, this just might be the something else.

I would have more to say about it, some examples even, except I’ve spent my last two evenings fiddling with my NSLU2, trying to get it actually up and working after having several hard drive issues. I’ve given up on one of my hard drives, but now the Debian install won’t finish, it dies half way through saying it failed to finish the configuration or some such thing.

Anyway, I may just have to give up on it sooner or later and start doing more interesting things, and once I do that, I’ll have something more to say about CouchDB, with some example code even.