SlideShare a Scribd company logo
1 of 54
Django
The Web Framework for Perfectionists with Deadlines

                 By: Udi h Bauman, BeeTV
This guy is happy
      with his vehicle




http://www.flickr.com/photos/24859010@N05/2350218142/
If only he knew of
  the alternatives




   http://www.flickr.com/photos/26418031@N04/2485301661/
consider your last software project
without alternatives as reference, you can’t estimate:




                   Effort
                    Pain
                Time waste
                Complexity
               Cost of change
so, just consider the Time it took
to get to a Happy Customer




                    Time
& also the time it took to develop version 2,
with different requirements & scale:




                                Time
Introducing
A Web Framework that shortens the Time
it takes to develop software in at least an

        Order of Magnitude
while also tremendously minimizing:
               Effort
                Pain
            Time waste
            Complexity
           Cost of change
              & more
How can Django do it?

• Django automates the stuff repeating in
  every software project
• & let’s you only work on what differentiates
  them
Metaphor


• Suppose you were a constructing company
• You get a customer request & spend a few
  months building what he wants
Metaphor
• Although every building is different, there
  are things repeating themselves every time
  • Ground works
  • Electricity
  • Water
  • Skeleton
  • &c
Metaphor
• Suppose some infra company came & said:
 • Just define to us what the customer need
 • Within few hours we’ll build the basic
    building
 • & in another day or so, we’ll help you
    complete it by answering all of the
    customer specific needs
 • So, you can deliver the building in <3 days
Metaphor

• You’ll probably laugh at them & say:
 • It’s probably pre-built/pre-assembled stuff
 • That limits what I can do
 • With low quality & scalability
 • & I’ll also need to pay you a lot
Metaphor
•   What if the company will answer
    •   It’s not pre-built - we build it by your
        definition
    •   It doesn’t limit you to do anything, on the
        contrary it helps you do whatever you want
    •   It has better quality & scalability than what
        you can build
    •   It costs you nothing
Metaphor



• What can you say to that?
Demo

• Let’s develop an Issue Tracking system
 • Issues data model
 • Users management (permissions, groups)
 • Rich Web UI (search, filters, last actions)
 • Scalable deployment (any # of users)
Demo


• & let’s try to do it in 20 minutes
Start timer
Try it out


• http://jbug-issues.appspot.com
Django was born here
Meaning: Deadlines

• Example: highest paid gov. officials analytics
  site
  • Requested at saturday night (22:00)
  • Skeleton ready & data entry start (23:00)
  • Site complete & in production (24:00)
By a group of
                perfectionists


                     Adrian Holovaty
Jacob Kaplan-Moss                      Simon Willison
                     @adrianholovaty
    @jacobian                            @simonw
Using the language
named after these guys
Language of choice in


• The organizations attracting the best
  programmers in the world
  • Such as:
More than a scripting language

• Pure OOP
• Native threading
• Functional features
• Runs some of the largest Web sites
 • Such as:
Why do I love Python?
 • Succinct yet very readable syntax
 • Very fast code-run-test cycle (no build)
 • Great introspection (saves tons of time)
 • Built-in data structures (Map, Immutable
   List)
 • Syntax sugar features (list mapping, &c)
Programming Languages
    Evolution Tree
• Regarding “Evolutionary dead end” of Java
 • If you’ll check out history, the languages
    that are designed by a company or
    committee, such as Java & Cobol, are
    usually the evolutionary dead-ends
  • See also Paul Graham’s famous article:
    http://www.paulgraham.com/
    javacover.html
Optimized for Perfect
    OOP Design
• Inheritance (Data Model, Templates &c)
• Enforced MVC
• Reusable APPS
• DRY
Reusable Apps?

• Your modules are very loose coupled, &
  can be used in other projects
• You can plug into your project many 3rd
  party reusable apps, immediately adding to
  your product complex functionality
 • No need for coding
Some reusable apps
django-ratings         django-ajax-validation   django-google-analytics    django-mailer

django-queue-service   django-announcements     django-email-confirmation   django-jits

django-liveblogging    django-atompub           django-discussion          django-galaxy

django-messages        django-audioplayer       django-db-log              django-evolution

django-authopenid      django-googlemap         django-compress            django-dynamic-media-
                                                                           serve
django-avatar          django-graphs            django-oembed              django-clevercss

django-basic-blog      django-microformats      django-object-view-tracking django-chunks

django-basic-library   django-tagging           django-navbar              django-ads

django-basic-people    django-survey            django-orm-cache           django-rest-interface

django-basic-places    django-voting            django-page-cms            django-registration

django-cron            django-wiki              django-photologue          django-mobileadmin

django-favorites       satchmo                  django-pingback            django-openid

django-forum           sorl-thumbnail           django-pressroom           django-oauth

django-gcal            django-mailfriend        django-mmo                 django-recommender
Example: Pinax
• A project containing many reusable apps
  you can immediately use to start with a
  full-featured web site, without a line of
  code
 • Using it you can get a full-pledged Web2.0
    social networking site, as basis for your
    web site (Example” http://cloud27.com)
 • 1st version developed over a weekend
Django features

• Django has a lot of built-in stuff, to boost
  productivity
  • Nevertheless, it strives to remain as small
    as possible, to support any extension &
    not limit what you can do
ORM

                  title, year = row[0], row[1]
1.                query = Show.objects.filter(title=title)
2.                if query.count() > 0:
3.                    show = query[0]
4.                else: # if not found, create one
5.                    show = Show()
6.                    show.title = title.encode('utf-8')
7.                    show.prod_year = year
8.                    show.save()
MVC
Automatic Admin UI
Generic Views

    
1. def list_people(request):
2.     return object_list(request, Person.all(), paginate_by=10)
3.  
4. def show_person(request, key):
5.     return object_detail(request, Person.all(), key)
6.  
7. def add_person(request):
8.     return create_object(request, form_class=PersonForm,
9.         post_save_redirect=reverse('myapp.views.show_person',
10.                                   kwargs=dict(key='%(key)s')))
11. 
Auth & user mgmt
Forms
   class FileForm(forms.ModelForm):
1.     name = forms.CharField(required=False, label='Name')
2.  
3.     def clean(self):
4.         file = self.cleaned_data.get('file')
5.         if not self.cleaned_data.get('name'):
6.             if isinstance(file, UploadedFile):
7.                 self.cleaned_data['name'] = file.name
8.             else:
9.                 del self.cleaned_data['name']
10.        return self.cleaned_data
11. 
12.    class Meta:
13.        model = File
URL config

   from django.conf.urls.defaults import *
1.  
2. urlpatterns = patterns('',
3.     (r'^articles/(d{4})/$', 'mysite.news.views.year_archive'),
4.     (r'^articles/(d{4})/(d{2})/$', 'mysite.news.views.month_archive'),
5.     (r'^articles/(d{4})/(d{2})/(d+)/$', 'mysite.news.views.article_detail'),
6.     (r'^comments/',      include('django.contrib.comments.urls')),
7. )
Templates
   {% extends 'base.html' %}
1. {% block title %}Person listing{% endblock %}
2.  
3. {% block content %}
4. <h1>Person listing</h1>
5. <a href=quot;{% url myapp.views.add_person %}quot;>Create person</a>
6.  
7. <ul>
8.   {% for person in object_list %}
9.     <li>
10.      <a href=quot;{% url myapp.views.show_person key=person.key
   %}quot;>{{ person.first_name }} {{ person.last_name }}</a>
11.      <a href=quot;{% url myapp.views.edit_person key=person.key %}quot;>Edit</a>
12.      <a href=quot;{% url myapp.views.delete_person key=person.key %}quot;>Delete</a>
13.    </li>
14.  {% endfor %}
I18n
Geo

1. class District(models.Model):
2.     name = models.CharField(max_length=35)
3.     num  = models.IntegerField()
4.     poly = models.PolygonField()
5.  
6.     objects = models.GeoManager()
7.  
8. class School(models.Model):
9.     name  = models.CharField(max_length=35)
10.    point = models.PointField()
11. 
12.    objects = models.GeoManager()
More built-in stuff
• Feeds
• Comments
• Flat pages
• Middleware
• Caching
• Signals
Django powered sites
• Many newspapers (LA Times, Washington
  Post, NY Times projects, Guardian API)
  • A django based site even won a Politzer!
• BitBucket (mercurial OSS repository)
• Pounce, Fluther, SuggestionBox, Tabblo,
  Revver (popular Web2.0 services)
• Curse (very high-traffic gaming site)
Scalability
• Django runs on regular web servers, such
  as Apache, Lighty or Ngynx, using a built-in
  Python or WSGI adapter
• This makes it very lightweight & scalable, as
  any LAMP deployment
  • There are examples of sites that handle
    MM reqs/hour, using less than 10 servers
Google AppEngine


• Based on Django
• Django apps can be easily deployed
IT acceptance
• IT environments today are mostly familiar
  with Java
• Solution: use Jython that compiles Python
  to bytecode
  • Package a Django project as .war
  • Sun constantly improves Jython &
    maintains compatibility /w Django
Implications

• On Outsourcing (no need for many out-
  sourced/off-shore programmers)
• On Build-vs-Buy (why buy when you can
  build any information system in an hour?)
Why not Rails?
•   Rails is also great, great people love it

•   However, I've got several things in which I think
    Rails is inferior, which people should consider

    •   Performance & scalability

    •   Emphasis on good design (no Magic in Django)

    •   Maturity

    •   Underlying language
Wanna start?

• Django Book (free, online, amazing)
• Dive into Python (free, online, amazing)
• Django Tutorial
IDE’s & Build tools
• I use Eclipse, using the PyDev plugin
 • NetBeans & IntelliJ also have Python
    support
  • Other commercial Python IDE’s are also
    excellent: Wingware, Komodo
• No need for build tools, it’s Python...
Links

• Django Sites
• Django People
• Django Project
• “Why I hate Django” keynote from
  DjangoCon
Q&A

More Related Content

What's hot

Hybrid Web Applications
Hybrid Web ApplicationsHybrid Web Applications
Hybrid Web ApplicationsJames Da Costa
 
Best Practices for Front-End Django Developers
Best Practices for Front-End Django DevelopersBest Practices for Front-End Django Developers
Best Practices for Front-End Django DevelopersChristine Cheung
 
Polymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill LibraryPolymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill Librarynaohito maeda
 
Introduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC FrameworksIntroduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC FrameworksGerald Krishnan
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpMatthew Davis
 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop APIChris Jean
 
Don't sh** in the Pool
Don't sh** in the PoolDon't sh** in the Pool
Don't sh** in the PoolChris Jean
 
GTM container positions: a summary of best & worst
GTM container positions: a summary of best & worstGTM container positions: a summary of best & worst
GTM container positions: a summary of best & worstPhil Pearce
 
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ..."Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...DrupalCamp Kyiv
 
A Gentle Introduction to Drupal's Views API
A Gentle Introduction to Drupal's Views APIA Gentle Introduction to Drupal's Views API
A Gentle Introduction to Drupal's Views APIDan Muzyka
 
Technical SEO for WordPress - 2019 edition
Technical SEO for WordPress - 2019 editionTechnical SEO for WordPress - 2019 edition
Technical SEO for WordPress - 2019 editionOtto Kekäläinen
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NETgoodfriday
 
jQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days TorontojQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days TorontoRalph Whitbeck
 
Views Style Plugins
Views Style PluginsViews Style Plugins
Views Style Pluginsmwrather
 
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...Cedric Spillebeen
 
An easy guide to Plugin Development
An easy guide to Plugin DevelopmentAn easy guide to Plugin Development
An easy guide to Plugin DevelopmentShinichi Nishikawa
 
Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019Matt Raible
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...Otto Kekäläinen
 

What's hot (20)

Hybrid Web Applications
Hybrid Web ApplicationsHybrid Web Applications
Hybrid Web Applications
 
Best Practices for Front-End Django Developers
Best Practices for Front-End Django DevelopersBest Practices for Front-End Django Developers
Best Practices for Front-End Django Developers
 
Polymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill LibraryPolymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill Library
 
Introduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC FrameworksIntroduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC Frameworks
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop API
 
Don't sh** in the Pool
Don't sh** in the PoolDon't sh** in the Pool
Don't sh** in the Pool
 
GTM container positions: a summary of best & worst
GTM container positions: a summary of best & worstGTM container positions: a summary of best & worst
GTM container positions: a summary of best & worst
 
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ..."Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
 
A Gentle Introduction to Drupal's Views API
A Gentle Introduction to Drupal's Views APIA Gentle Introduction to Drupal's Views API
A Gentle Introduction to Drupal's Views API
 
Technical SEO for WordPress - 2019 edition
Technical SEO for WordPress - 2019 editionTechnical SEO for WordPress - 2019 edition
Technical SEO for WordPress - 2019 edition
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
 
jQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days TorontojQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days Toronto
 
Views Style Plugins
Views Style PluginsViews Style Plugins
Views Style Plugins
 
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
 
Rebrand WordPress Admin
Rebrand WordPress AdminRebrand WordPress Admin
Rebrand WordPress Admin
 
An easy guide to Plugin Development
An easy guide to Plugin DevelopmentAn easy guide to Plugin Development
An easy guide to Plugin Development
 
Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
 
Fast by Default
Fast by DefaultFast by Default
Fast by Default
 

Similar to Intro To Django

JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesTikal Knowledge
 
Getting Started With Django
Getting Started With DjangoGetting Started With Django
Getting Started With Djangojeff_croft
 
Web Development in Django
Web Development in DjangoWeb Development in Django
Web Development in DjangoLakshman Prasad
 
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScaleGDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScalePatrick Chanezon
 
iPhone Development For Experienced Web Developers
iPhone Development For Experienced Web DevelopersiPhone Development For Experienced Web Developers
iPhone Development For Experienced Web Developerslisab517
 
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...John McCaffrey
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuningJohn McCaffrey
 
Castles in the Cloud: Developing with Google App Engine
Castles in the Cloud: Developing with Google App EngineCastles in the Cloud: Developing with Google App Engine
Castles in the Cloud: Developing with Google App Enginecatherinewall
 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWebDave Bouwman
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistMark Fayngersh
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To DjangoJay Graves
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletonGeorge Nguyen
 
gDayX - Advanced angularjs
gDayX - Advanced angularjsgDayX - Advanced angularjs
gDayX - Advanced angularjsgdgvietnam
 
I've (probably) been using Google App Engine for a week longer than you have
I've (probably) been using Google App Engine for a week longer than you haveI've (probably) been using Google App Engine for a week longer than you have
I've (probably) been using Google App Engine for a week longer than you haveSimon Willison
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Matt Raible
 
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume LaforgeGroovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume LaforgeGuillaume Laforge
 
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Guillaume Laforge
 

Similar to Intro To Django (20)

JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
 
django
djangodjango
django
 
Introduce Django
Introduce DjangoIntroduce Django
Introduce Django
 
Getting Started With Django
Getting Started With DjangoGetting Started With Django
Getting Started With Django
 
Web Development in Django
Web Development in DjangoWeb Development in Django
Web Development in Django
 
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScaleGDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
 
iPhone Development For Experienced Web Developers
iPhone Development For Experienced Web DevelopersiPhone Development For Experienced Web Developers
iPhone Development For Experienced Web Developers
 
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
 
Castles in the Cloud: Developing with Google App Engine
Castles in the Cloud: Developing with Google App EngineCastles in the Cloud: Developing with Google App Engine
Castles in the Cloud: Developing with Google App Engine
 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWeb
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To Django
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
 
gDayX - Advanced angularjs
gDayX - Advanced angularjsgDayX - Advanced angularjs
gDayX - Advanced angularjs
 
I've (probably) been using Google App Engine for a week longer than you have
I've (probably) been using Google App Engine for a week longer than you haveI've (probably) been using Google App Engine for a week longer than you have
I've (probably) been using Google App Engine for a week longer than you have
 
React django
React djangoReact django
React django
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
 
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume LaforgeGroovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
 
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
 

More from Udi Bauman

Intro to-django-for-media-companies
Intro to-django-for-media-companiesIntro to-django-for-media-companies
Intro to-django-for-media-companiesUdi Bauman
 
Django course final-project
Django course final-projectDjango course final-project
Django course final-projectUdi Bauman
 
Django course final-project
Django course final-projectDjango course final-project
Django course final-projectUdi Bauman
 
Django course summary
Django course summaryDjango course summary
Django course summaryUdi Bauman
 
Nonrelational Databases
Nonrelational DatabasesNonrelational Databases
Nonrelational DatabasesUdi Bauman
 
Ship Early Ship Often With Django
Ship Early Ship Often With DjangoShip Early Ship Often With Django
Ship Early Ship Often With DjangoUdi Bauman
 
Django Article V0
Django Article V0Django Article V0
Django Article V0Udi Bauman
 
Python Django Intro V0.1
Python Django Intro V0.1Python Django Intro V0.1
Python Django Intro V0.1Udi Bauman
 
Large Scale Processing with Django
Large Scale Processing with DjangoLarge Scale Processing with Django
Large Scale Processing with DjangoUdi Bauman
 
Django And Ajax
Django And AjaxDjango And Ajax
Django And AjaxUdi Bauman
 
Udi Google Dev Day
Udi Google Dev DayUdi Google Dev Day
Udi Google Dev DayUdi Bauman
 

More from Udi Bauman (12)

13
1313
13
 
Intro to-django-for-media-companies
Intro to-django-for-media-companiesIntro to-django-for-media-companies
Intro to-django-for-media-companies
 
Django course final-project
Django course final-projectDjango course final-project
Django course final-project
 
Django course final-project
Django course final-projectDjango course final-project
Django course final-project
 
Django course summary
Django course summaryDjango course summary
Django course summary
 
Nonrelational Databases
Nonrelational DatabasesNonrelational Databases
Nonrelational Databases
 
Ship Early Ship Often With Django
Ship Early Ship Often With DjangoShip Early Ship Often With Django
Ship Early Ship Often With Django
 
Django Article V0
Django Article V0Django Article V0
Django Article V0
 
Python Django Intro V0.1
Python Django Intro V0.1Python Django Intro V0.1
Python Django Intro V0.1
 
Large Scale Processing with Django
Large Scale Processing with DjangoLarge Scale Processing with Django
Large Scale Processing with Django
 
Django And Ajax
Django And AjaxDjango And Ajax
Django And Ajax
 
Udi Google Dev Day
Udi Google Dev DayUdi Google Dev Day
Udi Google Dev Day
 

Recently uploaded

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Recently uploaded (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Intro To Django

  • 1. Django The Web Framework for Perfectionists with Deadlines By: Udi h Bauman, BeeTV
  • 2. This guy is happy with his vehicle http://www.flickr.com/photos/24859010@N05/2350218142/
  • 3. If only he knew of the alternatives http://www.flickr.com/photos/26418031@N04/2485301661/
  • 4. consider your last software project without alternatives as reference, you can’t estimate: Effort Pain Time waste Complexity Cost of change
  • 5. so, just consider the Time it took to get to a Happy Customer Time
  • 6. & also the time it took to develop version 2, with different requirements & scale: Time
  • 8. A Web Framework that shortens the Time it takes to develop software in at least an Order of Magnitude
  • 9. while also tremendously minimizing: Effort Pain Time waste Complexity Cost of change & more
  • 10. How can Django do it? • Django automates the stuff repeating in every software project • & let’s you only work on what differentiates them
  • 11. Metaphor • Suppose you were a constructing company • You get a customer request & spend a few months building what he wants
  • 12. Metaphor • Although every building is different, there are things repeating themselves every time • Ground works • Electricity • Water • Skeleton • &c
  • 13. Metaphor • Suppose some infra company came & said: • Just define to us what the customer need • Within few hours we’ll build the basic building • & in another day or so, we’ll help you complete it by answering all of the customer specific needs • So, you can deliver the building in <3 days
  • 14. Metaphor • You’ll probably laugh at them & say: • It’s probably pre-built/pre-assembled stuff • That limits what I can do • With low quality & scalability • & I’ll also need to pay you a lot
  • 15. Metaphor • What if the company will answer • It’s not pre-built - we build it by your definition • It doesn’t limit you to do anything, on the contrary it helps you do whatever you want • It has better quality & scalability than what you can build • It costs you nothing
  • 16. Metaphor • What can you say to that?
  • 17. Demo • Let’s develop an Issue Tracking system • Issues data model • Users management (permissions, groups) • Rich Web UI (search, filters, last actions) • Scalable deployment (any # of users)
  • 18. Demo • & let’s try to do it in 20 minutes
  • 20. Try it out • http://jbug-issues.appspot.com
  • 22. Meaning: Deadlines • Example: highest paid gov. officials analytics site • Requested at saturday night (22:00) • Skeleton ready & data entry start (23:00) • Site complete & in production (24:00)
  • 23. By a group of perfectionists Adrian Holovaty Jacob Kaplan-Moss Simon Willison @adrianholovaty @jacobian @simonw
  • 24. Using the language named after these guys
  • 25. Language of choice in • The organizations attracting the best programmers in the world • Such as:
  • 26. More than a scripting language • Pure OOP • Native threading • Functional features • Runs some of the largest Web sites • Such as:
  • 27. Why do I love Python? • Succinct yet very readable syntax • Very fast code-run-test cycle (no build) • Great introspection (saves tons of time) • Built-in data structures (Map, Immutable List) • Syntax sugar features (list mapping, &c)
  • 28. Programming Languages Evolution Tree • Regarding “Evolutionary dead end” of Java • If you’ll check out history, the languages that are designed by a company or committee, such as Java & Cobol, are usually the evolutionary dead-ends • See also Paul Graham’s famous article: http://www.paulgraham.com/ javacover.html
  • 29. Optimized for Perfect OOP Design • Inheritance (Data Model, Templates &c) • Enforced MVC • Reusable APPS • DRY
  • 30. Reusable Apps? • Your modules are very loose coupled, & can be used in other projects • You can plug into your project many 3rd party reusable apps, immediately adding to your product complex functionality • No need for coding
  • 31. Some reusable apps django-ratings django-ajax-validation django-google-analytics django-mailer django-queue-service django-announcements django-email-confirmation django-jits django-liveblogging django-atompub django-discussion django-galaxy django-messages django-audioplayer django-db-log django-evolution django-authopenid django-googlemap django-compress django-dynamic-media- serve django-avatar django-graphs django-oembed django-clevercss django-basic-blog django-microformats django-object-view-tracking django-chunks django-basic-library django-tagging django-navbar django-ads django-basic-people django-survey django-orm-cache django-rest-interface django-basic-places django-voting django-page-cms django-registration django-cron django-wiki django-photologue django-mobileadmin django-favorites satchmo django-pingback django-openid django-forum sorl-thumbnail django-pressroom django-oauth django-gcal django-mailfriend django-mmo django-recommender
  • 32. Example: Pinax • A project containing many reusable apps you can immediately use to start with a full-featured web site, without a line of code • Using it you can get a full-pledged Web2.0 social networking site, as basis for your web site (Example” http://cloud27.com) • 1st version developed over a weekend
  • 33. Django features • Django has a lot of built-in stuff, to boost productivity • Nevertheless, it strives to remain as small as possible, to support any extension & not limit what you can do
  • 34. ORM         title, year = row[0], row[1] 1.        query = Show.objects.filter(title=title) 2.        if query.count() > 0: 3.            show = query[0] 4.        else: # if not found, create one 5.            show = Show() 6.            show.title = title.encode('utf-8') 7.            show.prod_year = year 8.            show.save()
  • 35. MVC
  • 37. Generic Views   1. def list_people(request): 2.     return object_list(request, Person.all(), paginate_by=10) 3.   4. def show_person(request, key): 5.     return object_detail(request, Person.all(), key) 6.   7. def add_person(request): 8.     return create_object(request, form_class=PersonForm, 9.         post_save_redirect=reverse('myapp.views.show_person', 10.                                   kwargs=dict(key='%(key)s'))) 11. 
  • 38. Auth & user mgmt
  • 39. Forms class FileForm(forms.ModelForm): 1.     name = forms.CharField(required=False, label='Name') 2.   3.     def clean(self): 4.         file = self.cleaned_data.get('file') 5.         if not self.cleaned_data.get('name'): 6.             if isinstance(file, UploadedFile): 7.                 self.cleaned_data['name'] = file.name 8.             else: 9.                 del self.cleaned_data['name'] 10.        return self.cleaned_data 11.  12.    class Meta: 13.        model = File
  • 40. URL config from django.conf.urls.defaults import * 1.   2. urlpatterns = patterns('', 3.     (r'^articles/(d{4})/$', 'mysite.news.views.year_archive'), 4.     (r'^articles/(d{4})/(d{2})/$', 'mysite.news.views.month_archive'), 5.     (r'^articles/(d{4})/(d{2})/(d+)/$', 'mysite.news.views.article_detail'), 6.     (r'^comments/',      include('django.contrib.comments.urls')), 7. )
  • 41. Templates {% extends 'base.html' %} 1. {% block title %}Person listing{% endblock %} 2.   3. {% block content %} 4. <h1>Person listing</h1> 5. <a href=quot;{% url myapp.views.add_person %}quot;>Create person</a> 6.   7. <ul> 8.   {% for person in object_list %} 9.     <li> 10.      <a href=quot;{% url myapp.views.show_person key=person.key %}quot;>{{ person.first_name }} {{ person.last_name }}</a> 11.      <a href=quot;{% url myapp.views.edit_person key=person.key %}quot;>Edit</a> 12.      <a href=quot;{% url myapp.views.delete_person key=person.key %}quot;>Delete</a> 13.    </li> 14.  {% endfor %}
  • 42. I18n
  • 43. Geo 1. class District(models.Model): 2.     name = models.CharField(max_length=35) 3.     num  = models.IntegerField() 4.     poly = models.PolygonField() 5.   6.     objects = models.GeoManager() 7.   8. class School(models.Model): 9.     name  = models.CharField(max_length=35) 10.    point = models.PointField() 11.  12.    objects = models.GeoManager()
  • 44. More built-in stuff • Feeds • Comments • Flat pages • Middleware • Caching • Signals
  • 45. Django powered sites • Many newspapers (LA Times, Washington Post, NY Times projects, Guardian API) • A django based site even won a Politzer! • BitBucket (mercurial OSS repository) • Pounce, Fluther, SuggestionBox, Tabblo, Revver (popular Web2.0 services) • Curse (very high-traffic gaming site)
  • 46. Scalability • Django runs on regular web servers, such as Apache, Lighty or Ngynx, using a built-in Python or WSGI adapter • This makes it very lightweight & scalable, as any LAMP deployment • There are examples of sites that handle MM reqs/hour, using less than 10 servers
  • 47. Google AppEngine • Based on Django • Django apps can be easily deployed
  • 48. IT acceptance • IT environments today are mostly familiar with Java • Solution: use Jython that compiles Python to bytecode • Package a Django project as .war • Sun constantly improves Jython & maintains compatibility /w Django
  • 49. Implications • On Outsourcing (no need for many out- sourced/off-shore programmers) • On Build-vs-Buy (why buy when you can build any information system in an hour?)
  • 50. Why not Rails? • Rails is also great, great people love it • However, I've got several things in which I think Rails is inferior, which people should consider • Performance & scalability • Emphasis on good design (no Magic in Django) • Maturity • Underlying language
  • 51. Wanna start? • Django Book (free, online, amazing) • Dive into Python (free, online, amazing) • Django Tutorial
  • 52. IDE’s & Build tools • I use Eclipse, using the PyDev plugin • NetBeans & IntelliJ also have Python support • Other commercial Python IDE’s are also excellent: Wingware, Komodo • No need for build tools, it’s Python...
  • 53. Links • Django Sites • Django People • Django Project • “Why I hate Django” keynote from DjangoCon
  • 54. Q&A

Editor's Notes