Python + Django + WordPress = My New Site
Over the years, I’ve made a handful of personal websites. When I first got out of design school, I had a flash site with enough extra bells and whistles to encourage visitors to forget that there wasn’t much content. Since then, I’ve hastily thrown together an HTML site every time I was about to start interviewing for jobs.
A few months back, I decide to remake my personal site during a period of my life where I was happy at my job and didn’t need to rush to get something up as soon as possible. I wanted to make a site with a proper database backend, so I could easily add projects as soon as they went live. This was a great excuse to learn some server side web development (having only ever really done basic front end work in the past).
I set out to find a language to learn. I tried a few introductory tutorials for Ruby and Python. Ruby appeared more interesting a first, but then I stumbled across the book Learn Python The Hard Way by Zed A. Shaw. Zed’s approach to teaching programming really appealed to me. In each exercise he instructs you to read through some example code, type it all in manually (instead of copy/pasting), get it to run. At the end of each exercise, there are extra credit objectives for modifying the code. I bought the $3 PDF (the online version is free) and got started. 52 thoroughly enjoyable exercises. Once I was done with Zed’s book, I was ready to learn a web framework.
Django was the only choice I really considered for web framework. Everything else seemed like it was geared at more experience programmers. Django has a great tutorial to build your first project (a poll app). After going through the tutorial, I tried to jump right into building my new site. I poured over Django documentation to learn as much as I could, but I was struggling with learning programming basics, python and Django all at the same time. I ended up with some data models that sort of made sense and the some half formed urls and views.
I needed to find a starting point to build on top of. Github had a few portfolio app built with Django. I ended up using Pigmonkey’s django-portfolio. His example showed how to design dynamic URLs for project pages and how to pass content into views. Pigmonkey’s app was set up so that each project had a single image associated with it. I added a project image model (with a foreign key relationship to a project) so that each one of my projects could have a variable number of images.
I had an existing wordpress blog that I wanted to continue using, but I needed to find a way to import recent posts into my landing page. I dug around and found django-feedutil which uses the Python library feedparser. feedutil gave me a Django template tag that let me bring my wordpress rss feed into a view and loop through a set of posts, grabbing out the title, link and publish date. Awesome.
My site was coming together, but I needed a place to host it. I researched setting up Python, Django and additional libraries on my old host. It looked like it might be possible, but I wasn’t in love with them, so I looked for a Django friendly web host.
I was sold on WebFaction when I found this great video tutorial on installing a Django app with their tools:
I’ve been quite happy with WebFaction so far. They were quite nice about a little incident where I accidentally used a huge amount of RAM while misusing feedutil.
Well, that’s how I got to my new site. It took exponentially more work than it would have to create another static site, but it was a great way to learn more about programming. Adding content and updating my site is going to be much easier, and I should have a site that will last for a long time.




