TEMPLATE_STRING_IF_INVALID = '%s' would be more appropriate as that will print the variable name that isn't defined instead of some random text. However read the admonition box on the second link very carefully. This is really for one-off debugging instances, not something you should just leave on all the time in development.
–
Chris PrattJan 24 '12 at 16:33

That's part of the design. It allows you to provide defaults and switch based on whether or not a variable exists in the context. It also allows templates to be very flexible and promotes re-usability of templates instead of a strict "each view must have it's own template" approach.

More to the point, templates are not really supposed to be "debugged". The idea is to put as much of your logic as possible outside the template, in the views or models. If you want to figure out why a variable that's supposed to be passed to the context isn't, the place to debug that is in your view. Just drop import pdb;pdb.set_trace() somewhere before your view returns and poke around.

@Marcin: I'm speaking in the sense of Django's perspective. If you're relying on template debug errors in development for things not related to fumble-fingering a templatetag or other simple mistakes, you've likely got too much logic in your template.
–
Chris PrattJan 24 '12 at 16:37

Well, that's a matter of opinion :) But it is the 'Django Opinion', and it if matters enough to you, use a different template engine! I do, for this reason among others.
–
AdamKGJan 24 '12 at 16:54