Charting Django


Published on

Presentation by Will Larson given at django-nyc on 11/18/2008.

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Charting Django

  1. 1. 11/18/2008, 7PM django-nyc Will Larson An intermediate over view of useful features. charting django (A map to avoiding that “Where is the bathroom?” “Under the sign.” “Oh.” feeling.)
  2. 2. qualifications It’s all true. Damnit. • Spent last year as English teacher. • Last presentation was to 13 year olds. • People skills. Damn it.
  3. 3. This presentation is geared towards django roadmap advanced beginners, who want a guide to become intermediate Djangonauts. 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>
  4. 4. Everyone needs three projects in their django experience trip towards Django mastery. Don’t be afraid to start over from scratch. When you make decisions with insufficient 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 GalleryProject be there. gallery builder LifeFlow blog engine django-userskins user-specific skins
  5. 5. Almost all of this functionality can be ignored, but by using it • your applications can be smaller, more flexible, and much easier to write. easy to feign mastery Moving from beginner to adept is • fixtures about increasing efficiency and quality, not necessarily about doing new things, but doing old things better. • template tags & filters • management commands • custom context harder to feign mastery • middleware
  6. 6. This is a common convention, rather than a feature. It’s even harder to learn convention than to learn features, because they’re often undocumented. • some project settings are location specific • some are not • Don’t Repeat Yourself • =>
  7. 7.
  8. 8. in VC • versioned: • • • kitchen sink • not versioned: •
  9. 9. variant This is how I roll. Bringing settings inheritance to the weary developer/sys admin • 2 + max(n,1) settings files hybrid. • • (not in version control!) • ??? (deploy, devel, staging, etc)
  10. 10. Can be used for initial and fixtures testing data, as well. I use fixtures 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 shell session
  11. 11. template tags & filters • Don’t Repeat Yourself for templates You’ve probably used the default templates and filters before. They’re good, but sometimes you run into missing functionality. Time to roll your own. • use when justified
  12. 12. template filters myapp/templatetags/ some_template.html
  13. 13. template tags, 1 • more powerful & complex than filters Kevin t wittered about the “pyif” templatetag. That’s a great example of some_template.html 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.
  14. 14. template tags, 2
  15. 15. management commands • periodic or one-time commands • great with cron This is your primary interface bet ween the shell and Django, along with: python shell
  16. 16. shell session
  17. 17. 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 generic views). • play nicely with generic views Try to keep them light weight to avoid slowing down everything.
  18. 18.
  19. 19. middleware • 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 • process_response solely focused on middleware and still have questions left over and rocks left unturned. • process_exception This is a sketch of a sketch of a map, but that’s all the time we have.
  20. 20.
  21. 21. 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 Marker Felt. • Irrational Exuberance @ • django-monetize @ lethain/django-monetize/tree/master/
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.