0% found this document useful (0 votes)
268 views19 pages

The Django Framework MSCOSCONF2009 #MOSC2010

The Django Framework By Low Kian Seong MSCOSCONF2009. MSC Malaysia Open Source Conference 2010 (MSC MOSC2010) Is Open For Registration http://conf.oss.my/
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODP, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
268 views19 pages

The Django Framework MSCOSCONF2009 #MOSC2010

The Django Framework By Low Kian Seong MSCOSCONF2009. MSC Malaysia Open Source Conference 2010 (MSC MOSC2010) Is Open For Registration http://conf.oss.my/
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODP, PDF, TXT or read online on Scribd
You are on page 1/ 19

The Django Framework

By Low Kian Seong


Who am I?

● @lowskter
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.
● Modular
– Ripping one thing out will not effect the engine.
● Useful decorators
● Templates
– Limited functionality
– Purposely made underpowered. Why?
Django components

● Models
● Views
● urls
● Templates
Django-Components

● models.py
● Definition for database schemas and fields.
Django-Components

● views.py
● Controlling what is being fed to the templates
and others. The C in MVC.
Django-Components

● urls.py
● 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

Q&A Session

You might also like