E-Scribe : a programmer’s blog

About Me

PBX I'm Paul Bissex. I build web applications using open source software, especially Django. Started my career doing graphic design for newspapers and magazines in the '90s. Then wrote tech commentary and reviews for Wired, Salon, Chicago Tribune, and others you never heard of. Then I built operations software at a photography school. Then I helped big media serve 40 million pages a day. Then I worked on a translation services API doing millions of dollars of business. Now I'm building the core platform of a global startup accelerator. Feel free to email me.


I co-wrote "Python Web Development with Django". It was the first book to cover the long-awaited Django 1.0. Published by Addison-Wesley and still in print!


Built using Django, served with gunicorn and nginx. The database is SQLite. Hosted on a FreeBSD VPS at Johncompanies.com. Comment-spam protection by Akismet.


Pile o'Tags

Stuff I Use

Bitbucket, Debian Linux, Django, Emacs, FreeBSD, Git, jQuery, LaunchBar, macOS, Markdown, Mercurial, Python, S3, SQLite, Sublime Text, xmonad

Spam Report

At least 237138 pieces of comment spam killed since 2008, mostly via Akismet.

From PHP to Python

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.

I think back to going cold turkey on Quark and moving to InDesign, which I've never regretted since Quark's software has sucked since version 5, a long time ago. But only now am I feeling even half as proficient as I was in Quark. Of course, there have been other time-saving plusses (not having to round-trip to Photoshop, etc.). Still, the design experience informs my apprehension about the PHP/Python question.

My gut response is: Of course you should learn Python! It's great!

But is it great for him? Is it great for someone who really just wants to keep a website up and running, making content updates and occasional feature tweaks? For someone who doesn't want to become a programmer? I mean, yes, designer Jeff Croft eventually was lured into writing Python code to support his Django blog habit, but that's an exceptional case, and he had some of the world's leading Django experts at his elbow as he was learning.

If it were just about the coding, though, I don't think it would be a tough call. It's really server and deployment issues that are the potential deal-breaker for someone who only wants web stuff to be a small part of their workday. As Ian Bicking and James Bennett and others have written about at length, the ubiquity of mod_php/Apache on shared hosting servers means that PHP deployment for script authors is a non-issue. Upload the file and it's deployed.

My aphorism on the subject: There are a lot of nice things about PHP, it's just that the language isn't one of them.

I think my friend's XPress/InDesign analogy (I am stubbornly nerdy about calling the product "XPress", not just "Quark", sorry!) is pretty apt. It takes a while to become productive with a new tool, even one that is objectively much better than the old one. I was a real whiz at Quark XPress myself way back when, working for Disney Publishing and Ziff-Davis. I know exactly what he is saying about missing those hard-won ninja skills even when enjoying the fruits of the nicer tool.

I have a longer piece in me (some day, once the book is wrapped) aimed at the nitty-gritty, language-level and application-level details a PHP developer might stumble over when moving to Django and Python. For now I'll just say that I don't remember missing much as I began moving away from PHP several years ago.

Every year, general-purpose web hosting offerings get more powerful (q.v. Slicehost) and Python deployment options become more robust (q.v. mod_wsgi). If you get hooked on the language, then you will have sufficient motivation to brave that deployment frontier. So my advice in the end is: yes, learn Python (and then Django, of course).

Thursday, March 13th, 2008
+ + + +

0 comments pending approval
Comment from Eater , later that day

I wish like hell I had embraced Python about ten years sooner than I did. It's one of those things I never had the time for -- but when I finally made the time, I cursed myself for wasting so much time ;)

More to the point, it sounds like Python (and of course, Django) will simplify your friend's life a great deal.

Comment from Ray Smith , later that day

My suggestion would be to look at Drupal (or Joomla depending on your preference). Drupal gives you a great framework, tools, community and professional services while still using his PHP skills.

Python is a great language and I think it should be used by more people for more tasks ... but as you say the whole deployment issue for the smaller scale web sites is just plain difficult.

And I agree, the PHP language just plain sucks and Python is beautiful ;)

Comment from azeem , later that day

Do we also need to learn Javascript, CSS, HTML and other thigjamalies if we decide for Python. Or just Python also will be good enough for software jobs.

Comment from Paul , later that day

If you're doing web stuff, then yes, you'll still need to learn those relevant front-end technologies. But you can learn Python without worrying about any of that stuff -- in fact, I think it's best to begin learning Python on its own. See the official Python tutorial, for example.

Comment from Jacob , 1 week later

I really agree with you. I actually blogged about the same topic a little bit ago. i tried learning PHP, its just a mess. It is easy to understand and linear, but it just doesn't pay off in the long run.

Best, J

Comment from Semi , 2 weeks later

I'm trying to learn PHP at this time and i also have heard a lot about python. Thanks for your post, it brought me some clarity in this issue.

Comment from Jason Calleiro , 8 weeks later

I think a lot more people would try out django and python if it would be easier to get up and running. It took me forever to get up and running following 4 different tutorials.

But now that i am rolling i can see why python people speak so proudly about their language of choice.

Comment from Paul , 8 weeks later

Hi Jason,

Unfortunately, that's a familiar story, at least when it comes to deployment. In my experience helping (many) people, the most common stumbling blocks for newcomers are 1) understanding how the Python import path works and 2) handling static files, since Django doesn't serve them.

We've tried to address these points of confusion in our book of course, but in the meanwhile one other good spot for help besides the official tutorial material is the #django IRC channel FAQ and the documentation it links to.

Glad you're up and running -- welcome!

Comment from Erick , 17 weeks later

Any language sucks. Suckability depends on the programmer. I've seen superlative PHP code, and I've seen cumbersome Python or Java code.

As for frameworks for PHP, Code Igniter and CakePHP are nice, but they're soon becoming as bloated as that PEAR schtick. If all you need is a DB, a session manager, and a user manager, then all these frameworks are useless.

Comment from Burhan , 17 weeks later

I can speak with some authority on this as I am migrating 6 years of PHP know-how to django and python.

I agree wholeheartedly that the main issue was trying to get around the installation/setup issue. Sure python manage.py runserver is the first "wow" thing about django (and by extension python), but when it comes time for deployment there are tons of stumbling blocks.

I still like PHP but the more I look at it, I feel it allows for "lazy" programming -- things like not bothering with type checks are a-okay, when in reality they shouldn't.

Once I get more familiar with Python itself and really "unlearn" the PHP habits that I have, I feel I will be more comfortable completely switching over.

On a side note -- Paul, do you have a writeup on how this site was built? What modules you used, how everything is put together, etc? It would be a great help to me.

Comment from Derek , 2 years later

"If all you need is a DB, a session manager, and a user manager, then all these frameworks are useless."

I am sure many websites start out like this... my experience is that just about all of them persist far longer than anticipated and tend to acquire extra features over time. So, rather start with a robust framework like Django and avoid pain further downstream.

If you read "The Django Book" it shows you quite clearly how to do many of these things without a framework, and then goes on to highlight how & where using a framework can be really time (and sanity) saver.

Comments are closed for this post. But I welcome questions/comments via email or Twitter.