Introduction to django (and py)
-
Upload
adrianandreias -
Category
Technology
-
view
956 -
download
2
description
Transcript of Introduction to django (and py)
![Page 1: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/1.jpg)
{
Introduction To Django (+ py)
Adrian Andreiaș, Elvsofthttp://twitter.com/adiandreias
![Page 2: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/2.jpg)
• 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)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/3.jpg)
1. Short look at Python2. Introduction To Django3. Django live coding: A Digg app
Summary
![Page 4: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/4.jpg)
• 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)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/5.jpg)
...
• 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)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/6.jpg)
Python syntax
![Page 7: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/7.jpg)
• 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)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/8.jpg)
Fully:• object-oriented programming• structured programming
Elements of:• functional programming• aspect-oriented programming
Python paradigms
![Page 9: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/9.jpg)
• (google) Python tutorial• (google) Dive Into Python
Learning Python
![Page 10: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/10.jpg)
• 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)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/11.jpg)
• 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)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/12.jpg)
• 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)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/13.jpg)
• 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)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/14.jpg)
Models
![Page 15: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/15.jpg)
urls.py
![Page 16: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/16.jpg)
Views
![Page 17: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/17.jpg)
Templates (with inheritance!)
![Page 18: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/18.jpg)
• Automatic admin interface• Cache system• Internationalization• Authentication & authorization• Form processing and form sets
Django free stuff
![Page 19: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/19.jpg)
Coding a DIGG app
![Page 20: Introduction to django (and py)](https://reader033.fdocuments.in/reader033/viewer/2022061605/555a71e7d8b42a972b8b501c/html5/thumbnails/20.jpg)
Other questions?
?