Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Charting Django

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

  • Login to see the comments

Charting Django

  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. qualifications It’s all true. Damnit. • Spent last year as English teacher. • Last presentation was to 13 year olds. • People skills. Damn it.
  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. 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. 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. 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 • =>
  8. in VC • versioned: • • • kitchen sink • not versioned: •
  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. 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. 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. template filters myapp/templatetags/ some_template.html
  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. template tags, 2
  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. shell session
  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.
  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.
  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/