Introduction to Django Web Framework



Similar documents
Using Python, Django and MySQL in a Database Course

Django Web Framework. Zhaojie Zhang CSCI5828 Class Presenta=on 03/20/2012

Outline. Lecture 18: Ruby on Rails MVC. Introduction to Rails

Slides from INF3331 lectures - web programming in Python

Web Frameworks. web development done right. Course of Web Technologies A.A. 2010/2011 Valerio Maggio, PhD Student Prof.

Rapid Website Deployment With Django, Heroku & New Relic

Web Application Frameworks. Robert M. Dondero, Ph.D. Princeton University

Introduction to FreeNAS development

django-gcm Documentation

Table of Contents. Table of Contents

Web [Application] Frameworks

Whisler 1 A Graphical User Interface and Database Management System for Documenting Glacial Landmarks

The Django web development framework for the Python-aware

Nupic Web Application development

CS169.1x Lecture 5: SaaS Architecture and Introduction to Rails " Fall 2012"

Web [Application] Frameworks

Para perfeccionistas con deadlines

Design Proposal for a Meta-Data-Driven Content Management System

web frameworks design comparison draft - please help me improve it focus on Model-View-Controller frameworks

Effective Django. Build Nathan Yergler

latest Release 0.2.6

Next- Generation Web Frameworks in Python

OpenText Information Hub (ihub) 3.1 and 3.1.1

django-cron Documentation

PROJECT REPORT OF BUILDING COURSE MANAGEMENT SYSTEM BY DJANGO FRAMEWORK

Getting Started with Telerik Data Access. Contents

AALTO UNIVERSITY SCHOOL OF SCIENCE AND TECHNOLOGY. Re-engineering an Online User Interface over Web Application Framework and Ajax

Django tutorial. October 22, 2010

ARCHITECTURAL DESIGN OF MODERN WEB APPLICATIONS

f...-. I enterprise Amazon SimpIeDB Developer Guide Scale your application's database on the cloud using Amazon SimpIeDB Prabhakar Chaganti Rich Helms

Customer Bank Account Management System Technical Specification Document

Taxi Service Design Description

Web Development Frameworks

Oracle Application Development Framework Overview

Memopol Documentation

Ruby On Rails. CSCI 5449 Submitted by: Bhaskar Vaish

MarkLogic Server. Reference Application Architecture Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

Acquia Introduction December 9th, 2009


Developer Tutorial Version 1. 0 February 2015

Business Application Development Platform

Introduction to web development with Python and Django Documentation

Integrating VoltDB with Hadoop

Object Relational Database Mapping. Alex Boughton Spring 2011

Ruby on Rails. a high-productivity web application framework. blog.curthibbs.us/ Curt Hibbs <curt@hibbs.com>

easyobject modern web applications made easy Project presentation

Drupal Module Development

NoSQL web apps. w/ MongoDB, Node.js, AngularJS. Dr. Gerd Jungbluth, NoSQL UG Cologne,

Pillars of Python: Six Python Web frameworks compared

Web Application Development and Frameworks

Certified PHP/MySQL Web Developer Course

Symfony vs. Integrating products when to use a framework

Pro<DOC/> e-commerce Technology An Introduction

Realization of Inventory Databases and Object-Relational Mapping for the Common Information Model

Cloud Powered Mobile Apps with Azure

Sample HP OO Web Application

CIS 192: Lecture 10 Web Development with Flask

Web Development with Flask and the Raspberry Pi Leading by Example CUAUHTEMOC CARBAJAL ITESM CEM 22/04/2014

SoftwarePlanner Active Directory Authentication

THE NEW DIGITAL EXPERIENCE

Web Application Development for the SOA Age Thinking in XML

Web Development Paradigms and how django and GAE webapp approach them.

personalkollen fredag 5 juli 13

Getting Started Guide for Developing tibbr Apps

A Comparison of Open Source Application Development Frameworks for the Enterprise

A WEB INTERFACE FOR NATURAL LANGUAGE PROCESSING DRIVEN FAQ WEBSITE. A Thesis. Presented to the. Faculty of. San Diego State University

BEST WEB PROGRAMMING LANGUAGES TO LEARN ON YOUR OWN TIME

Content management system comparison

Test-Driven Development with Python

INFOPATH FORMS FOR OUTLOOK, SHAREPOINT, OR THE WEB

A benchmark approach to analyse the security of web frameworks

SIF 3: A NEW BEGINNING

Creating federated authorisation

Ettema Lab Information Management System Documentation

django-helpdesk Documentation

MatchPoint Benefits with SharePoint 2013

The Definitive Guide to Django: Web Development Done Right Adrian Holovaty, Jacob K. Moss. Buy at Amazon

Designing RESTful Web Applications

Advanced Web Development SCOPE OF WEB DEVELOPMENT INDUSTRY

Django FTP server Documentation

MOZU APP CERTIFICATION FOR THIRD-PARTY DEVELOPMENT. Certification Guide Mozu

SOA, case Google. Faculty of technology management Information Technology Service Oriented Communications CT30A8901.

This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

ORACLE MOBILE APPLICATION FRAMEWORK DATA SHEET

Enterprise Access Control Patterns For REST and Web APIs

System. CMS Vendor Comparison. Ektron 8.6. Drupal Sitecore 6.5. Kentico EMS 8.2. EPiServer WordPress SharePoint Umbraco 4.

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

TravelMatch Architectural Design Document Version 1.0

QAD BPM Release Notes

Paul Boisvert. Director Product Management, Magento

Session 6 Patterns and best practices in SOA/REST

SOA Planning Guide The Value Enablement Group, LLC. All rights reserved.

Standards, Tools and Web 2.0

Kentico CMS 7.0 E-commerce Guide

ASP.NET Overview. Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland

Manage all your Office365 users and licenses

View our AppExchange listing for AddressTools here:

Linked Data Publishing with Drupal

Transcription:

Introduction to Django Web Framework Web application development seminar, Fall 2007 Jaakko Salonen <jaakko.t.salonen@tut.fi> Jukka Huhtamäki <jukka.huhtamaki@tut.fi> 1

http://www.djangoproject.com/ Django The MacGyver of Web Frameworks http://www.unessa.net/en/hoyci/2007/ 01/django-macgyver-web-frameworks/ Django gets the big picture http://www.oreillynet.com/ onlamp/blog/2006/07/ django_gets_the_big_picture.html Image from: WikipediaTampere University of Technology 2

In this presentation A short history of Django Key Philosophies Key Features An example: [Implementing] poll application in Django An example: Testing in Django Discussion and questions 3

A short history of Django Originally developed at World Online as a publishing framework Fall 2003 Summer 2005 The developers at World Online switched from PHP to Python. Django was born. Django is open sourced, community begins to emerge Fall 2007 Latest official version is still 0.96.1 Hundreds of sites use Django [Near] future Final 1.0 release with stabile API, along with a book (Holovathy and Kaplan- Moss 2007) 4

Key Philosophies As according to (http://www.djangoproject.com/): Loose Coupling Clear interfaces between different layers of the framework Less code Especially by utilising Python's dynamic capabilities Quick [Web] Development Focus on outcome, not on the details Don t Repeat Yourself Single placement for every distinct concept and/or data An MTV(?) (Model-Template-View) framework Rather than MVC (Model-View-Controller) Emphasis on reusability and "pluggability" of components 5

Key Features (1/2) As according to (http://www.djangoproject.com/): Object-relational mapper (ORM) For dynamic data-access API (cf. Ambler, 2006) Polished administration interface for end-users With configurable CRUD support (Create,Read,Update,Delete) Elegant URL design for parameter-free URIs hiding the technology, based on URL mapping (cf. Berners-Lee, 1998) Template system providing means to separate design, content and code 6

Key Features (2/2) Built-in web application core features Authentication (session management, login/logout) Authorisation (user rights and roles), Multi-site support for single-source publishing and Redeployable apps Built-in Internationalisation (i18n) support Based on translation strings Cache support Instructions are provided for integrating Memcached (http://www.danga.com/memcached/) into a Django app Built-in test framework (doctests and unit tests) 7

Example: Poll application in Django (1/7) Task: to implement a site that lets people view polls and vote in them (and manage polls) A summary of Django's tutorial, for more comphrensive version, see http://www.djangoproject.com/documentation/tutorial01/ 8

Example: Poll application in Django (2/7) Step 1/3: Poll Model polls/ models.py views.py templates/ polls.html from django.db import models class Poll(models.Model): question = models.charfield(max_length=200) pub_date = models.datetimefield('date published') class Admin: pass class Choice(models.Model): poll = models.foreignkey(poll) choice = models.charfield(max_length=200) votes = models.integerfield() 9

Example: Poll application in Django (3/7) Step 2/3: Poll View (control logic for latest polls) polls/ models.py views.py templates/ polls.html from mysite.polls.models import Poll from django.http import HttpResponse def index(request): latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5] output = ', '.join([p.question for p in latest_poll_list]) return HttpResponse(output) 10

Example: Poll application in Django (4/7) Step 3/3: Poll Template (a representation) polls/ models.py views.py templates/ polls.html {% if latest_poll_list %} <ul> {% for poll in latest_poll_list %} <li>{{ poll.question }}</li> {% endfor %} </ul> {% else %} <p>no polls are available.</p> {% endif %} 11

Example: Poll application in Django (5/7) Database schema is generated from the model: $ python manage.py syncdb BEGIN; CREATE TABLE "polls_poll" ( "id" serial NOT NULL PRIMARY KEY, "question" varchar(200) NOT NULL, "pub_date" timestamp with time zone NOT NULL ); CREATE TABLE "polls_choice" ( "id" serial NOT NULL PRIMARY KEY, "poll_id" integer NOT NULL REFERENCES "polls_poll" ("id"), "choice" varchar(200) NOT NULL, "votes" integer NOT NULL ); COMMIT; 12

Example: Poll application in Django (6/7)..And test server is available instantly: $ python manage.py runserver 8080 <ul> </ul> <li>what is your favourite food?</li> <li>what is your favourite movie?</li> <li>what is up?</li> <li>if you had more time, you would dedicate it to what?</li> 13

Example: Poll application in Django (7/7) Poll administration? The user interface is readily generated! 14

Example: Inserting doctest to Poll Model Doctests can be written directly to model definitions (models.py)... class Poll(models.Model): >>> p = Poll(title=u'Your favourite movie') >>> p.question = 'What is your favourite movie?' >>> p.save() >>> p <Poll: 'Your favourite movie'> >>> p.question What is your favourite movie?... Running the tests $ python manage.py test 15

Discussion Content management is addressed by many features A statement for that Django is designed for implementing content management systems Clear emphasis on agile web publishing...even in favor of framework genericity and extensibility Questions that have to be asked: Is Django fit for Rich Internet Application (RIA) development? What if database bindings are complex? How much of the web application core features can be customised? (admin UI, authentication, etc.) 16

Questions Question? Comments? Discussion! Jaakko Salonen <jaakko.t.salonen@tut.fi> Jukka Huhtamäki <jukka.huhtamaki@tut.fi>

References [Ambler, 2006] Mapping Objects to Relational Databases: O/R Mapping In Detail. [Berners-Lee, 1998 ] Cool URIs don't change. Online article. Available at <http://www.w3.org/provider/style/uri>. [Holovathy and Kaplan-Moss, 2007]. The Definitive Guide to Django: Web Development Done Right. To be published.