From Journalism to Django, Part One: Prerequisites

Posted Tuesday, January 26, 2010 at 10:26 p.m. by Chris Amico in Projects about Django, journalism and Python

Programming is hard.

There's no way around it: Learning to make a computer do things means learning a new form of expression. It is not, in some ways, all that different from learning a spoken language.

But it's also fun in an addictive sort of way. It's like telling your Legos to build themselves. When things start to click, massive problems begin to break apart into a long series of eminently squashable bugs.

Before you start learning Django, a few things I recommend brushing up on:

  • (X)HTML: This is, after all, a framework for building web applications. You don't have to be a pro, but you should know how content is structured online and how it gets there. Recommendation: HTML Dog.

  • Understand relational databases: Again, no need to be an expert (my SQL skills still aren't what they should be), but you should understand what a relational database is and why it's important on the web. Two recommendations here: First, an introduction to databases. Then, start playing around with SQLite.

  • Install Wordpress: The modern web is built on applications, and blogging software is a good place to start. Buy some server space (or download MAMP) and take five minutes to learn how to create a MySQL database, drop in the code and get a blog up and running.

  • Learn to love the command line. Get used to browsing directories and moving, renaming and copying files without a visual interface. If you're on a Mac, put Terminal in your dock. If you're on Windows, consider buying a Mac, then see step one. If you're on Linux, I assume you've skipped this entire post because you already know Python.

  • Find and learn to use a good text editor. Start here. Pick something with syntax highlighting.

Things to think about

Embarrass yourself. Here's another parallel to learning to speak Chinese. You will make dumb mistakes. You will break things. You will spend days hunting for the one misplaced comma that turns your beautiful application into an ugly stack trace.

That's OK. It's the only way to learn. (And you can always delete it.)

Want to feel better about yourself? Read some of my early questions on the Django Users Group.

Be stubborn. Matt Waite called this a key requirement:

"The drive to not quit the first time they hit a wall, get confused, get frustrated, etc. If they're not willing to commit to work until they have a functioning app, then they shouldn't start."

Read the source code. How did people learn programming before open source? With almost any coding problem I come across, my first assumption is that someone has faced something similar before. Spend some time trolling Github and Google Code.

Read everything you can. Hang out on Stack Overflow and the Django Users Group. Read the documentation when you're bored. And on that note...

Blogs you should be reading

James Bennett is Django's release manager and something of an absolutist about documentation. Raid his archives for a host of practical tips and code recipes. I also recommend his [book].

Jeff Croft is one of the more prominent designers in the Django community. Read his old posts to get the hang of template inheritance and explainers for non-programmers.

There is a huge community out there. Check out the Django blog aggregator and see what jumps out at you.

What else?

Django people, what else should be on this list?


jan 27, 2010 at 4:54 p.m. // Pierce Presley said:

Listen, Mac fanboy, I hate to be the one to tell you this, but telling people they either need to shell out for a Mac or learn Linux is really going to limit the number of people learning Django, especially if they're buying their own hardware. It's far better, I think, to encourage people to learn with what they have, not add the burden of learning new hardware and a new OS to learning Django. Besides, installing a decent WAMP stack plus Python isn't a terribly complicated endeavor (an easy route for newbies comfortable installing programs is BitNami), and you can get plenty done in either the command line or with GUI-based tools. Heck, if you're determined to use Unix-fu, you can get Cygwin. And you can always transfer gained skills to a Mac or Linux box (or make your box a Linux box). I have yet to learn Django (or Python), and I'm looking forward to your posts, but starting off by telling 90 percent of computer users that they need to buy a new computer or install a new OS isn't the way to go.

jan 27, 2010 at 6:15 p.m. // Matt Waite said:

Except, Pierce, that it is good advice. Telling people it's okay to learn web development on Windows is similar to telling people they can learn accounting on Linux. Can you? Sure. Is it completely against the grain of the overwhelmingly predominant paradigm in a particular industry? Yes it is. The simple fact is that most web development is done today on servers running Linux. Can you rent Windows Server hosting? Sure. But the vast majority isn't Windows. Most web developers use Macs or Linux (a few I know run Linux on their Mac even). While Windows may be commonplace for everything else, it's just simply not the predominant tool for web developers. Are there web developers who use Windows? Sure. Are they commonplace? Not hardly. Even the open source technologies themselves are most often developed on Linux first, everything else later. So by going Windows, you're running against the grain of the very technologies you're trying to learn.

So before you go calling people names, learn something about the industry.

jan 27, 2010 at 6:22 p.m. // Alex said:

Mac fanboy, LOL! But I would sort of agree with Pierce's points if not his tone, which dilutes the points made.

I use Linux, and a good command line/terminal/shell and UNIX-like commands are really useful in programming in general, let alone the wealth of free and open software that is a breeze to install and run (and installing and running it on a desktop Linux is not that different from on a production server).

Mac is OK, but everything that is good about programming on a Mac is, I'd argue, already in Linux, and the price premium is for things that are not useful for programming.

Windows when equipped with a lot of downloaded packages is OK too, I'd just suggest downloading and setting up the initial environment in which to develop is more of a pain than Mac and Linux, especially tolls for a FOSS environment (MS's suites usually install and run very well).

I'd agree with the principal that someone didn't have to buy an expensive new computer to become a developer. Especially when developing in languages that are interpreted and typically demand a low amount of resources.

Ubuntu 9.10 is really nice, runs super fast, and can be both dual booted, run from CD/USB, installed on an old machine, or used as a primary OS while Windows runs inside a VM. If someone was interested in a powerful programming environment I'd suggest looking at that before buying a Mac.

I'd add one more tip: be agnostic to an extent. While Django might be an aim, keep looking around at other approaches to the same problems.

jan 27, 2010 at 8:59 p.m. // Derek Willis said:

To expand on Matt's point, it's not just going against the grain to do this stuff on Windows. It actually hampers your ability to learn, since most users and developers of frameworks like Django or Rails don't use Windows. That means that it's harder to troubleshoot problems, and that the universe of people who can help you is narrower.

And although you can both learn and use frameworks on Windows, in my experience (particularly with Rails), they run slower. Much slower. So your experience is likely to be more frustrating.

This isn't a fanboy issue; it's real and something that every person who is looking to learn about frameworks needs to know and consider.

jan 29, 2010 at 1:05 a.m. // Pierce Presley said:

Okay, the "fanboy" thing wasn't terribly serious (and since when was calling someone that a mortal insult? most Apple fans I know revel in it), though the rest of my points were. I forget sarcasm doesn't work on the Web. Matt, I am, and always will be, a proponent of learning what you can with what you have (or can get cheaply). In that vein, it's OK IMO to work with what you have. For most people, that's going to be a Windows box. I didn't propose seeking out Windows hosting, which is getting harder to find every day and is way behind Linux on bang-for-the-buck. And I wonder if learning accounting is the right analogy--I certainly expect to spend some time working on getting numbers into a spreadsheet in the right order before we talk double-entry vs. single-entry and cash vs. accrual basis. And I'm pretty sure you can do that in Excel, Lotus 1-2-3, Calc or Google Docs, at least at the beginning. Alex, I didn't say so, but I would expect anyone who wants to do serious Web development to move into Linux at some point, certainly if they're like me and use Linux hosting. And I'm hopeful that Ubuntu 9.10 will be the release where I'm not stymied by multiple hardware incompatibilities that require compiling obscure source code to resolve, if they can be resolved at all. For people with pedestrian hardware, it's a great choice--but at the very beginning, when someone's just kicking off, I say go with what you have. (And I'm serious, BitNami, AppServ, WampServer, XAMPP, etc. are at least as easy to install as Ubuntu is. When can fit instructions in less than two screens, it's not that damned hard.) Derek, okay, slower would suck, especially for learners like myself. But I have to ask, would it be that big a deal working on Hello, World and the like? And if it would, wouldn't pointing people toward Linux, which works, as Alex pointed out, on a wide range of hardware, be a better option that saying "get thee to a Genius Bar"?

jan 29, 2010 at 1:12 a.m. // Pierce Presley said:

(By the way, Chris, your site choked on my complete comment with a "Correct the error below" message, but didn't point out that the error was that the comment was too long.)

I'm well aware that all of you probably program at a level I won't achieve for quite a while--if at all--(by which time you'll have advanced--damn you, Zeno!), and you're working on projects I'm not fit to proofread, but I have to ask what the utility is of a framework (or a programming language, or an application) that can't run well enough for learning tasks on common hardware and a common OS years after it was developed? I'm not saying stay in Windows forever, I'm not saying don't be prepared to host your app on a Linux server, I'm not even saying don't consider the question of what you want to learn on. I'm saying that saying "Get a Mac" to the vast majority of journalists, especially those out of work, and students is saying "This will likely be too expensive for you." Saying "If you're on Linux, I expect you already know Python" is saying "Don't try Linux unless you already know Python." If you don't want to troubleshoot Windows problems, fine, write a decent down-to-journalists level LAMP install tutorial--including instructions for finding out how to get several balky components working. Or expect a lot to put Django in the "not right now" bin. Which would be bad. We don't need people making the same mistake about learning this that so many of us have made about learning HTML, audio, video, you name it.

jan 29, 2010 at 1:41 a.m. // Alex said:

Something Windows is really quite great for developing in is anything that goes in one of Microsoft's suites, be it some kind of .NET or C#. They really are fantastic for developing in languages that tend not the be FOSS, very polished products.

But I digress, my main point was amusement that people commenting on this post have something in common not that often seen unless in geek circles, and a niche of geek circles at that:

Chris Amico: Pierce Presley: Matt Waite: Alex Bowman:

c'mon Derek!

jan 29, 2010 at 3:06 a.m. // Pierce Presley said:

Derek's been at so long, I wonder that he hasn't changed his name IRL. (Has it really been since 1998? I know I've been aware of Derek and his site since at least 2002, maybe earlier.) Plus it looks like someone's squatting on, the bastards.

jan 29, 2010 at 6:43 a.m. // Derek Willis said:

Sorry guys, but I've made my domain choice. Actually, Pierce is right; it was made for me by a domain squatter back in 98.

But more to the point, I learned Django on Windows initially, and while it's possible to do so, it really was much more frustrating than it had to be, and the very serious consequence is that when things go wrong, you have fewer people to ask for help. That's just a fact, and I doubt it will change anytime soon. If I were doing it again, I'd install Linux if I couldn't get my hands on a Mac.

I don't think Chris is saying you have to get a Mac or you can't learn frameworks. I think he's saying that most folks who might already have Linux in front of them probably don't need the advice here. Note that's "most", not all. So by all means install Linux and go to town. In some respects it'll be easier to learn frameworks, and certainly easier to understand deployment issues.

may 31, 2010 at 12:25 p.m. // matt short said:

I learnt django on a windows box first and i think you're all missing the biggest block to django design on a windows box.

itd be cruel to not tell you so i will ;)

windows boxes just aren't built to cope with python dependancies and the installation of various python modules. they just aren't.

i spent a day trying to get an installation of PIL onto it. it wasn't long before i installed os x onto the same hardware and i can honestly say i've found it far easier to code django on mac.

there is a caveat though. i am quite worried about browser testing when designing on the smallest market share of the platforms i want my sites to support.

Comments are closed for this post. If you still have something to say, please email me.