“I’m a PHP programmer and I want to check out this Django thing. What should I do?” I’ve been seeing this kind of question pop up more and more, and I have a few answers. First-hand experience as well as many conversations with developers online have led me to the same conclusion: the curious person behind such a question should be encouraged and assisted. (I’ll call that person “Pat” for the rest of the post, for convenience and conscientious gender-neutrality.
I’m doing a small experiment in open source distribution. I have a site, toolbot.com, which formerly was a collection of miscellaneous PHP scripts that I had assembled over the years for specific tasks – package tracking, dummy text generation, link shortening, etc. Those tools are now offline. The original cause of their disappearance was a MySQL failure, but that really just provided an opportunity for me to make a break with that pile of old code.
A former colleague from my days in print design (and a wonderfully loyal reader of my blog to boot) writes to ask whether he should learn Python. He’s a smart guy with a deep background in typography, publishing, and the Mac. He is not a programmer by trade, but has taught himself enough PHP to build a custom CMS for his newspaper. He writes: I’ve invested so much time in PHP, and am quite proficient now (not bad for it being more of an avocation), but I respect your opinion and for a long time have wondered about switching.
$ sudo portupgrade php5 php5-curl php5-sqlite php5-bla bla bla... ---> Upgrading 'php5 bla bla bla...' ... [Updating the pkgdb bla bla... done] $ sudo apachectl graceful $ This was on a live server, with only the briefest of interruptions; no drama. Boring things should be boring. I love FreeBSD. Chip Kaye commented on Sat Jan 6 11:27:47 2007: Hi Paul, Was this FreeBSD/Darwin under OS X, or do you like to run a true/stock FreeBSD server?
I’ve yanked out my own crude anti-comment-spam tests and replaced them with a nice tidy call to the Akismet API. If this works out I’ll most certainly incorporate it into the Django version of the blog – there’s a nice Python interface as well. seanrox commented on Thu Aug 24 14:58:33 2006: Akismet is nice and works wonders on comment spam as you’ll see on your site. The guys over at automattic.
The long-awaited (by me) conversion of this blog to Django is underway. After a couple hours’ work I have a full set of models and a functioning admin, and working index and detail views of postings and comments. Searching, posting comments, and tags are the major pieces remaining. Because of my busy schedule I’ll only be able to work on it in fits and starts, but I expect the total labor in the end to be about five hours.
For larger web projects I’ve moved almost exclusively to Django, but PHP is still handy. Recently I wanted to quickly (really quickly) make a flat-heirarchy site with dynamic pages, with clean urls like example.com/foo and example.com/bar. I could do this with several directories containing index.php files, but I want to use the Google Maps API on several of these pages, and the separate directories would entail separate Google Maps API access keys – a pain.