The Django Framework

By Low Kian Seong

Who am I?


Why Django

Aka. How I became a Zope refugee.

Events leading to me deflecting.

● ●

Flexibility vs. Usability Backed by some of the arguably the greatest Pythonistas Great community. Good resources. A book, planet and mailing lists which are actively maintained.

● ●

Why Django

Helper functions not hand holding functions MVC
– –

Or … M-VC Tight coupling of VC. Ripping one thing out will not effect the engine.


Useful decorators Templates
– –

Limited functionality Purposely made underpowered. Why?

Django components
● ● ● ●

Models Views urls Templates

● ● Definition for database schemas and fields.

● ● Controlling what is being fed to the templates and others. The C in MVC.

● ● Controlling what is served up based on the url that the user is accessing. Lots of regex and pattern matching here.

Some Django tools that are used in a lot of projects

This slide is also known as Django killer features Some of django's killer features …
– – – – –

Admin interface Generic Views Tags and Filters Development server Loose coupling

Admin interface

One liner to data modelling

Generic Views
● ● ●

Quick scripts for CRUD Powerful and Extensible engine. Some of the generic views available:
– – –

Simple redirects Date based actions List helper functionalities.

Shrinking your code size while adding the functionality.

Django-Generic Views
● ●

Simple Views A simple view:

urlpatterns = patterns('django.views.generic.simple', (r'^foo/$', 'direct_to_template', {'template': 'foo_index.html'}), (r'^foo/(?P<id>\d+)/$', 'direct_to_template', {'template': 'foo_detail.html'}), )

What if you wanted to do more with templates?

For those who think the templates are not powerful enough. Some default built in django tags and filters. Custom tags and filters.

● ●

Django javascript support
● ●

Rails vs. Django vs. TG javascript support Underpowered?

Django deployment
● ●

Apache – mod_python/mod_wsgi Windows/Linux support

Case Study
● ● ●

Process script Data modelling and manipulations Two case studies-processing scripts+django web front Leveraging the dynamic Python programming language for various system tasks. What? No bash?!

Some interesting modules that I want
● ●

Django-evolve Django-sqlalchemy

Django resources
● ● ●

Django modules Django snippets examples Free Django book!


Q&A Session

Sign up to vote on this title
UsefulNot useful