Django 101
Upcoming SlideShare
Loading in...5
×
 

Django 101

on

  • 3,118 views

Introduction to Django, given at an Auckland NZPUG meeting in June 2008.

Introduction to Django, given at an Auckland NZPUG meeting in June 2008.

Statistics

Views

Total Views
3,118
Views on SlideShare
3,115
Embed Views
3

Actions

Likes
1
Downloads
41
Comments
0

3 Embeds 3

http://www.slideshare.net 1
http://www.linkedin.com 1
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />
  • <br /> <br /> <br />

Django 101 Django 101 Presentation Transcript

  • Django 101 Robert Coup http://rob.coup.net.nz/
  • What is Django? “ The Web framework for perfectionists with deadlines Django makes it easier to build better Web apps more quickly and with less code www.djangoproject.com
  • Who am I? • Robert Coup • CTO of Koordinates - making geospatial data more accessible - http://koordinates.com • OSS contributor • 2 year Djangonaut • robert@coup.net.nz
  • What’s it for? • Building dynamic Web sites • A high level Web framework • Abstracts common problems • Shortcuts for fast development
  • Key Features • nice url handling • object : db mapping • forms • templating • admin interface • caching, syndication, middleware, email, sql, modules, authentication, sessions, comments, sitemaps, gis, …
  • So? And? • work at a nice abstraction level • just Python, no magic • gets out of your way
  • Architecture • “MVT” • Models describe your data • Views control what a user sees and does • Templates are what they see
  • Sample App - Yachties • Yacht racing crews • Schedule of races • Notify and Invite crew to races • Know who’s coming
  • Install Django • Database: Sqlite, Postgres, MySQL, Oracle • Web: Apache, FastCGI, wsgi, dev-server • Use Trunk, checkout from SVN • www.djangoproject.com/download • python setup.py install
  • Projects and Apps • django-admin startproject yachties • cd yachties • django-admin startapp racing
  • Models • models.py • describes the fields • turned into database tables • the logic and rules of the application
  • Settings • settings.py • Just a Python file
  • Databases • Django will create your tables for you • python manage.py syncdb • Additional SQL commands: • python manage.py sql* • Ability to preload data
  • Shell • python manage.py shell • from yachties.racing.models import Race • Manipulate your models live
  • Server • Server for development & debugging • python manage.py runserver • http://localhost:8000/
  • Automatic Admin Site • Built dynamically from your models • Authentication & validation • Flexible and customisable
  • URL Handling • All in urls.py • Separates views from how they’re called • Just regular expressions
  • Views • The “controller” • Just Python functions • that take a request • and return a response
  • Templates • What the user sees • No code
  • Templates • Pulls data from a dictionary (“context”) • Simple logic constructs (“tags”) • Simple data manipulation (“filters”) • Inheritance
  • More • Form generation & handling • Contrib apps: • builtin: admin, forms, gis, feeds, • 3 party: see Google Code rd • Any Python code will work with Django
  • Support • Quality documentation • Django Book www.djangobook.com • www.djangosnippets.org • Mailing lists, IRC
  • Google App Engine • Google’s “cloud computing” platform • Python based • Runs Django • Modified model layer • http://code.google.com/appengine/
  • Sites • Lots of news/journalism sites • Washington Post • Pownce • Koordinates • www.djangosites.org
  • Questions?