20
{ Introduction To Django (+ py) Adrian Andreiaș, Elvsoft http://twitter.com/adiandreias

Introduction to django (and py)

Embed Size (px)

DESCRIPTION

Introduction to django (and py)

Citation preview

Page 1: Introduction to django (and py)

{

Introduction To Django (+ py)

Adrian Andreiaș, Elvsofthttp://twitter.com/adiandreias

Page 2: Introduction to django (and py)

• Worked as software engineer (C++, C#)• Graduated UBB, Cluj in 2003• Founded Elvsoft in 2004• PHP, then switched to Python & Django• Currently internet hosting & tools

Shameless self promotion

Page 3: Introduction to django (and py)

1. Short look at Python2. Introduction To Django3. Django live coding: A Digg app

Summary

Page 4: Introduction to django (and py)

• interpreted, general-purpose high-level programming language

• design philosophy emphasizes code readability

• combine "remarkable power with very clear syntax“

• batteries included

Python goals

Page 5: Introduction to django (and py)

...

• Readability counts.• There should be one-- and preferably

only one --obvious way to do it....• If the implementation is hard to explain,

it's a bad idea.…

The Zen of Python

Page 6: Introduction to django (and py)

Python syntax

Page 7: Introduction to django (and py)

• dynamic typed• duck typed = name resolution (late

binding)“if it walks like a duck, and quacks like a duck, then it is a duck"

Python is

Page 8: Introduction to django (and py)

Fully:• object-oriented programming• structured programming

Elements of:• functional programming• aspect-oriented programming

Python paradigms

Page 9: Introduction to django (and py)

• (google) Python tutorial• (google) Dive Into Python

Learning Python

Page 10: Introduction to django (and py)

• The Web framework for perfectionists with deadlines

• Django makes it easier to build better Web apps more quickly and with less code.

Django is

Page 11: Introduction to django (and py)

• Loose coupling• Less code• Quick development• DRY (Don't Repeat Yourself)• Explicit is better than implicit• Consistency• Encourage best practices

Django philosophy

Page 12: Introduction to django (and py)

• Python developers should (mainly) write Python code (not YAML, XML, SQL)

• No generated code• Use introspection, Luke!• Web development done right:

• validations• separation of concerns• clean URLs• take care sql and mail form injections etc.

Some Django principles

Page 13: Introduction to django (and py)

• MTV instead of MVC• Models: Object-relational mapper• Template engine• Views: python functions, Request

in, Response out• URL mapping: list of regular

expressions

Django components

Page 14: Introduction to django (and py)

Models

Page 15: Introduction to django (and py)

urls.py

Page 16: Introduction to django (and py)

Views

Page 17: Introduction to django (and py)

Templates (with inheritance!)

Page 18: Introduction to django (and py)

• Automatic admin interface• Cache system• Internationalization• Authentication & authorization• Form processing and form sets

Django free stuff

Page 19: Introduction to django (and py)

Coding a DIGG app

Page 20: Introduction to django (and py)

Other questions?

?