over view of useful
(A map to avoiding that
“Where is the bathroom?”
“Under the sign.”
It’s all true. Damnit.
• Spent last year as English teacher.
• Last presentation was to 13 year olds.
• People skills. Damn it.
This presentation is
advanced beginners, who
want a guide to become
I hate that term.
• beginner - templates, views and urls
• intermediate - why you’re listening to me
• advanced - reusable applications
<img src=“funnyPicture.png”>Cats? Kids?</img>
Everyone needs three projects in their
trip towards Django mastery.
Don’t be afraid to start over from
scratch. When you make decisions
with insufﬁcient knowledge is like
trying to get into a building when you
don’t know how to open doors.
Project a hole in Concept Status
You’ll probably have to blow
the wall, and even after you learn
about the door the hole is still going to
LifeFlow blog engine
django-userskins user-speciﬁc skins
Almost all of this functionality
can be ignored, but by using it
your applications can be smaller,
more ﬂexible, and much easier to
write. easy to feign mastery
Moving from beginner to adept is
• ﬁxtures about increasing efﬁciency and
quality, not necessarily about
doing new things, but doing old
• template tags & ﬁlters
• management commands
• custom context
harder to feign mastery
This is a common
convention, rather than
It’s even harder to learn
convention than to learn
features, because they’re
• some project settings are location speciﬁc
• some are not
• Don’t Repeat Yourself
• => local_settings.py
local_settings.py in VC
• kitchen sink
• not versioned:
This is how I roll.
inheritance to the weary
• 2 + max(n,1) settings ﬁles hybrid.
• local_settings.py (not in version control!)
• ???_settings.py (deploy, devel, staging, etc)
Can be used for initial and
testing data, as well.
I use ﬁxtures to maintain a
local copy of my blog, to
extract data to run
• export and import data statistics, and--sadly--I do
use it for simple migrations.
• extremely poor man’s schema migration
template tags & ﬁlters
• Don’t Repeat Yourself for templates
You’ve probably used the
default templates and
ﬁlters before. They’re
good, but sometimes you
run into missing
Time to roll your own.
• use when justiﬁed
template tags, 1
• more powerful & complex than ﬁlters
Kevin t wittered about the “pyif”
templatetag. That’s a great example of
complex and powerful.
That’s because it’s mostly a wrapper
around the Python eval() function, i.e. it
is basically a templatetag that provides
direct access to the Python interpreter.
Model-View-Controller be damned, lets
throw the interpreter into the templates.
custom context These really extend the usability
of generic views by letting you
inject arbitrary data into all
templates (well, all templates
• manage global information served by views that use
RequestContext, which includes
• play nicely with generic views Try to keep them light weight to
avoid slowing down everything.
• four levers to defy Django physics
• process_request This is a totally inadequate
introduction to middleware, which are
one of the more nuanced features of
• process_view Django.
You could have a 30 minute talk that
solely focused on middleware and still
have questions left over and rocks
• process_exception This is a sketch of a sketch of a map,
but that’s all the time we have.
Visit my blog if you’re
interested in reading
about... stuff. Yeah, or don’t
visit it. That’s cool too.
What isn’t cool is how
smilely faces look in
• Irrational Exuberance @ http://lethain.com/
• django-monetize @ http://github.com/
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.