From No Clue to 3 Websites with Django in 1 week

July 18, 2008

I started “40 hours ago” without much knowledge of Python or Django (I had played with both for a couple hours a while back). Now I have three mini-sites using the Django framework live.

Thus, my first few experiences with Django on Python have been remarkable. First some

Story-telling

(The meat and potatoes are below …)

Update: I am not responsible for any of these website’s anymore, but the stories still hold!

1) My wife started a home-based child care business for the Tigard (Oregon) area. I put together a mini-website that lets her edit page content, add pages and manage an activity log that is accessible only to registered parents. More work is necessary, especially for content. I was focusing on high ranking in Google when doing keyword research, registering the domain name and putting content together, but I was a little surprised to see this site come up in the first position of the SERP for the query “day care tigard” a few days after posting it. The challenge now is to make it first for “child care tigard” … but I have a few ideas.

2) We updated the previous splash site for EcoFarms International, LLC, which specializes in growing organic produce year-round. The business users can now post “newsletters” (similar to blog entries) either as a new page or as a PDF upload. The key functionality is the newsletter notification, which is sent to people who signed up for it. I am working on making this a little bit more robust along the lines of Foreclosures 4 Investors, for which I implemented a system that sends on the order of 100,000 opt-in e-mails per month. The business users also get statistics regarding how often recipients click on links in the notifications.

3) A good friend of mine is getting married, so I put together a simple site with an RSVP form. I spent most of the time on the design (of the website and an invitation), which was based on work provided by Ben Tabb, a web designer here in Portland.

The mythical man week

All three sites together took less than 40 weekend-only-early-morning-and-night hours (the weekdays where slammed with my work at Aisle7). That includes (almost) all design work, all markup and styling work, all programming and framework configuration, all the time spent setting up the sites at the hosting provider and all client communication.

Stunned and humbled

That’s not bad for three projects. Especially considering that when I started, I had very little–virtually no–experience either in programming Python or working with the Django Framework. The 40 hours also included me setting up an appropriate development environment after researching the options, learning “pythonic” programming, reading the relevant Django documentation and diving into the framework. I spent parts of this man week debugging mistakes like ('not a tuple') instead of ('a tuple',) and learning about mutable function parameter defaults (thanks to PyLint[1], and no, I don’t think it’s a wart) as well as the intricacies of the PYTHON_PATH. I fixed a bug locally in the Django framework that caused the ConditionalGetMiddleware not to function properly (a later update from trunk applied the exact same fix). And I found a simple SMTP server written in Python that I could use to test the notification function and the RSVP form locally. Having WebFaction as a hosting provider enabled me, within this time frame, to also configure trac (including the Eclipse Mylyn-trac integration) and SVN (including post-commit e-mail notifications for our loosely coupled team). I don’t know of any other platform/tool combination that would allow (me) this level of productivity.

BTW, I spent an estimated 4 of those 40 hours fixing CSS styling issues around IE 6 quirks, which shows how much this browsers really sucks. (Or how poor my CSS skills are? Nah, that can’t be it …)

The right tool for the right job

Django is great to work with, but it helped to have a certain development environment setup: I run PyDev on Eclipse (including the extensions). I have the Django SVN trunk checked out and configured as a project in Eclipse. Each new project gets the Django project as a dependency, which gives me code completion and automatic import statement generation. This configuration also enables me to click on any Django class or method and jump directly to the source, which is better than any documentation.

I am fairly new to Python, and I am already very excited about the language. What impresses me is the brevity of the code that is achieved without relying on hacky shortcuts–all the syntax clutter was simply left out.


[1] The number of steps needed getting PyLint to work justify a separate post.

 

Advertisements

2 Responses to “From No Clue to 3 Websites with Django in 1 week”

  1. bernd Says:

    nire, good luck with your site and django!

  2. sethrh Says:

    Thanks for the link to the smtp server — I’ve been looking for one of those for a while.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: