Django

2,227 views

Published on

An introduction to Django Framework, version 1.1 - History, main features, weakness, next improvements.

Django

  1. 1. Django Project 1.1 An Introduction to django Vinicius Ronconi - vinicius.ronconi@gmail.com
  2. 2. Schedule <ul><ul><li>What is django? </li></ul></ul><ul><ul><li>History </li></ul></ul><ul><ul><li>Who uses django? </li></ul></ul><ul><ul><li>Main features </li></ul></ul><ul><ul><li>What must be improved </li></ul></ul><ul><ul><li>Django Structure </li></ul></ul><ul><ul><li>  Next steps </li></ul></ul><ul><ul><li>References & Other presentations </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  3. 3. What is django? <ul><ul><li>A Web Development Framework designed to increase productivity by automating repetitive tasks </li></ul></ul><ul><ul><li>Django provides high-level abstractions of common patterns, shortcuts for frequent programming tasks </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  4. 4. History <ul><ul><li>Named after the jazz guitarrist Django Reinhardt, from the 1930s to 1950s. </li></ul></ul><ul><ul><li>  Created by World Online, an online newspaper in 2003. </li></ul></ul><ul><ul><li>Became open source in 2005. </li></ul></ul><ul><ul><li>Created to meet fast deadlines of journalism websites, whilst at the same time keeping the development process clean and maintainable. </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  5. 5. Who uses django? <ul><ul><li>NatGeo </li></ul></ul><ul><ul><li>Michael Moore </li></ul></ul><ul><ul><li>Whashington Post </li></ul></ul><ul><ul><li>New York Times </li></ul></ul><ul><ul><li>  NEBULA Project (NASA) </li></ul></ul><ul><ul><li>Google App Engine </li></ul></ul><ul><ul><li>Rede Globo </li></ul></ul><ul><ul><li>VMWare </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  6. 6. Main Features <ul><ul><li>Automatic Admin Interface </li></ul></ul><ul><ul><li>Template Language, including inheritance </li></ul></ul><ul><ul><li>Internationalization </li></ul></ul><ul><ul><li>Elegant URL's </li></ul></ul><ul><ul><li>Object-Relational Mapper </li></ul></ul><ul><ul><li>Cache Framework </li></ul></ul><ul><ul><li>Testing Framework </li></ul></ul><ul><ul><li>Built-in RSS / Atom </li></ul></ul><ul><ul><li>Built-in Site Maps </li></ul></ul><ul><ul><li>Geospacial Content (via GeoDjango)  </li></ul></ul><ul><ul><li>Flatpages  </li></ul></ul><ul><ul><li>Lots of extensions </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  7. 7. What must be improved <ul><ul><li>Built-in migrations </li></ul></ul><ul><ul><li>CMS Extras lacking (wysiwyg, file browser) </li></ul></ul><ul><ul><li>No integrated deployment toolchain </li></ul></ul><ul><ul><li>REST/SOAP support lacking </li></ul></ul><ul><ul><li>No support for multiple databases (will be solved in v1.2) </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  8. 8. Django Structure - Directory Structure <ul><ul><li>myproject/ </li></ul></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><ul><ul><li>myapp/ </li></ul></ul></ul>__init__.py Tells Python that this directory should be considered a Python package. It can be empty or contain package initialiation code. manage.py A command-line utility that lets you interact with this Django project in various ways settings.py Settings/configuration for this project. urls.py a &quot;table of contents&quot; of a Django-powered site. Vinicius Ronconi - vinicius.ronconi@gmail.com
  9. 9. Django Structure - Directory Structure <ul><ul><li>Files inside myapp: </li></ul></ul>__init__.py Tells Python that this directory should be considered a Python package. It can be empty or contain package initialiation code. models.py Defines the content of the Model Layer. views.py Contains the code required to process the request. This file can be renamed, but it is recommended to keep this name. Vinicius Ronconi - vinicius.ronconi@gmail.com
  10. 10. Django Structure - Projects and Applications <ul><ul><li>An App is a Web Application that does something. </li></ul></ul><ul><ul><li>A Project is a collection of configuration and apps for a particular Web site. </li></ul></ul><ul><ul><li>A project can contain multiple apps. An app can be in multiple projects. </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  11. 11. Django Structure - MTV <ul><ul><li>MTV - Model, Template, View </li></ul></ul><ul><ul><li>Model is the Database access layer </li></ul></ul><ul><ul><ul><li>How to Access data </li></ul></ul></ul><ul><ul><ul><li>How to validate it </li></ul></ul></ul><ul><ul><ul><li>Which behaviour it has </li></ul></ul></ul><ul><ul><ul><li>The relationship between data </li></ul></ul></ul><ul><ul><li>Template is the presentation layer </li></ul></ul><ul><ul><ul><li>How the data must be displayed to the users? </li></ul></ul></ul><ul><ul><li>View is the business logic layer </li></ul></ul><ul><ul><ul><li>Access the model and defers to appropriate template. </li></ul></ul></ul><ul><ul><ul><li>It is the bridge between Model and Template. </li></ul></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  12. 12. Next Steps <ul><ul><li>Django 1.2 launched on May, 17th </li></ul></ul><ul><ul><ul><li>CSRF Protection improvements </li></ul></ul></ul><ul><ul><ul><li>Internationalization improvements </li></ul></ul></ul><ul><ul><ul><li>Allow multiple databases </li></ul></ul></ul><ul><ul><ul><li>Email backends (configure how django sends emails) </li></ul></ul></ul><ul><ul><ul><li>Template caching </li></ul></ul></ul><ul><ul><ul><li>Object Level permissions  </li></ul></ul></ul><ul><ul><li>Django 1.2 with Python 2.6 is already supported by WebFaction. </li></ul></ul><ul><ul><li>See more at http://docs.djangoproject.com/en/dev/releases/1.2/ </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  13. 13. References <ul><ul><li>Django Project Official Website </li></ul></ul><ul><ul><li>Django Book </li></ul></ul><ul><ul><li>Django Snippets </li></ul></ul><ul><ul><li>Aprendendo Django no Planeta Terra (pt-br) </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  14. 14. Other presentations <ul><ul><li>Jason Davies </li></ul></ul><ul><ul><li>wiremine </li></ul></ul><ul><ul><li>Jacob Kaplan-Moss </li></ul></ul><ul><ul><li>Igor Sobreira (pt-br) </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com
  15. 15. <ul><ul><li>Questions ? </li></ul></ul>Vinicius Ronconi - vinicius.ronconi@gmail.com

×