Jacob Kaplan-Moss

Seasoning Templates

I wrote this post in 2007, more than 15 years ago. It may be very out of date, partially or totally incorrect. I may even no longer agree with this, or might approach things differently if I wrote this post today. I rarely edit posts after writing them, but if I have there'll be a note at the bottom about what I changed and why. If something in this post is actively harmful or dangerous please get in touch and I'll fix it.

I’m a food geek. I spend my free time contemplating recipes. I bore my friends by talking about the Maillard reaction and annoy them by saying things like, “did you know that cheesecakes aren’t actually cakes at all?” I wonder about the techniques for replacing chemical with organic leavening and vice versa. I watch the Food Network, and Alton Brown is my hero.

I cook a lot, of course, and I’ve gotten pretty good at it. However, there are still a couple of things that give me problems. One area in particular is especially vexing to me:


See, I’m a sodium fiend. I adore salty food. I’ve got half a dozen kinds of salt [1] in my kitchen right now. I add extra salt to nearly everything I eat, and that’s the problem: if I salt foods until they taste “right” to me, most other people will think that my food’s far too salty. I’ve had to learn through trial and error what other people’s tolerance for salt is; my own taste buds are essentially broken.

It’s nearly impossible to get right. There’s a whole range of tastes when it comes to salt: my mom likes her food nearly salt-free; my wife has a pretty average taste for salt; I am (as previously discussed) way over on flat side of the bell curve.

Cooking for myself is easy but what to do when cooking for a crowd? If I aim to satisfy my own taste, my guests will wonder how I managed to spill my saltshaker without noticing. I can’t just leave salt out; a certain amount of salt has to be cooked in from the beginning (that 1/2 teaspoon of salt in chocolate chip cookies is vital and couldn’t just be sprinkled on to taste – ugh).

No, the smart thing to do is to aim for the big bulgy area right in the middle of that bell curve. If I get it right, I’ll match the average taste, which means I’ll be able to please the greatest number of people. Sure, my mom will still think my food tastes a bit too oceany, and I’ll need to add some extra salt to satisfy my craving, but the majority of people who eat my food will be happy.

Designing a template language is a lot like seasoning a dish; there’s a whole range of tastes out there. Options range from a language that allows variable substitution and nothing else all the way up to templates that embed a full-featured programming language.

Like seasoning a dish, we aim Django’s template language towards the average. That of course means that a some will find it bland and some will spit it out in disgust.

My advice to those people is to learn how to cook.

[1]Table, kosher, pickling, sea, rock, and popcorn, if you must know.


It’s about to be seven: Bacon Salt