SlideShare a Scribd company logo
Welcome to the Django!
What's Django? "Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design."   from http://www.djangoproject.com/   "...and not a CMS System."
Origins... Django Reinhardt
Origins... Lawrence-Journal World
Origins... Pycon 2005 - Adrian Holovaty e Simon Willison BSD License* Django Software Foundation - 2008 * http://en.wikipedia.org/wiki/BSD_licenses
www.djangoproject.com
Skills    Convention Over Configuration  Object-Relational Mapping (ORM) Very useful admin CRUD Form handling Elegant URL Design Template system Cache system i18n      
Principles  (...or philosophies)       DRY ( Don't Repeat Yourself ) Loose coupling  Write  less  code as possible Quick  development Explicit is better than implicit        
...and the best, is
MVC? No... MTV!
MVC vs. MTV       M odel -->  M odel V iew -->  T emplate C ontroller -->  V iew
Overview
Go to the Project!
  Download  djangoproject.com/download Install Unzip Django-x.x.tar.gz python setup.py install Or...  apt-get install python-django  (Debian like OS) Setting up...
Create a Project...       django-admin.py startproject my_project
Setup files   __init__.py - indicates a python package   manager.py - admin tasks     settings.py - project settings     urls.py - project urls map
Let's to do something... Open  settings.py : DATABASE_ENGINE = 'sqlite3' DATABASE_NAME = 'myblog.db' add 'django.contrib.admin' Open  urls.py : Uncomment the line: " from django.contrib... " Uncomment the line: " admin.autodiscover()... " Uncomment the line: " (r'^admin... "
Development server       python manager.py syncdb     python manager.py runserver [8000]
Others Servers... Development Server   Apache + Mod_Python   Apache + FastCGI
Create the app        python manage.py startapp my_blog
Setup files     init.py  - indicates a python package   models.py  - app domain model   views.py  - project controller
App x Project     App  - web app that do something. E.g. XXX Project  - lot of apps and themselves settings. A project can be a lot of apps, and a app can stay in severals projects
Create the model       Open  models.py  and edit:      from django.db import models class Artigo(models.Model): titulo = models.CharField(max_length=100) conteudo = models.TextField() publicacao = models.DateTimeField()
Setting the model classes to admin Open  admin.py  and edit:        from django.contrib import admin from models import Artigo   admin.site.register(Artigo)
Add the app to the admin      Open  settings.py  and add: "my_project.blog" Re-sync the database Re-run the development server
Setting the urls   Open the  urls.py  and edit:     from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() from my_blog.models import Artigo urlpatterns = patterns('', (r'^$', 'django.views.generic.date_based.archive_index', {'queryset': Artigo.objects.all(), 'date_field': 'publicacao'}), (r'^admin/(.*)', admin.site.root), )
Setting the templates   Create  templates/blog/artigo_archive.html  and edit:      <html><body> <h1>Meu blog</h1> {% for artigo in latest %} <h2>{{ artigo.titulo }}</h2> {{ artigo.conteudo }} {% endfor %} </body></html>
Look your app!        http://localhost:8000/
Recap...       Django is easy Django is fun Django scales Django is maintainable Django saves small kittens It rocks -  USE IT! 
Sites powered by Python/Django
 
Contact/follow us... [email_address] [email_address] Twitter: @leofernandesmo @felipe_wally

More Related Content

PDF
Mini Curso de Django
PDF
Odoo development workflow with pip and virtualenv
PDF
Como construir uma Aplicação que consuma e produza updates no Twitter usando ...
PPTX
DJUGL - Django and AWS Lambda
PPTX
PowerShell: Automation for everyone
PPTX
Introduction tomongodb
ODP
Mangling
PDF
The MetaCPAN VM Part II (Using the VM)
Mini Curso de Django
Odoo development workflow with pip and virtualenv
Como construir uma Aplicação que consuma e produza updates no Twitter usando ...
DJUGL - Django and AWS Lambda
PowerShell: Automation for everyone
Introduction tomongodb
Mangling
The MetaCPAN VM Part II (Using the VM)

What's hot (20)

PPTX
PDF
Gigigo Rails Workshop
PPT
How Danga::Socket handles asynchronous processing and how to write asynchrono...
PDF
Search 500-video-clips
PDF
WP Weekend #2 - Corcel, aneb WordPress přes Laravel
PPT
Perlbal Tutorial
PDF
Locarise,reagent and JavaScript Libraries
PDF
What The Flask? and how to use it with some Google APIs
PDF
Profiling PHP with Xdebug / Webgrind
PPTX
Learning Svelte
PDF
Basic commands for powershell : Configuring Windows PowerShell and working wi...
PDF
No Hugging, No Learning
PPT
Introduccion app engine con python
PPTX
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"
PDF
SFScon17 - Paolo D'Incau: "Build, test and release your software using Free S...
PDF
Pydata-Python tools for webscraping
PDF
#Continuous delivery with #Deployit
PDF
CasperJS and PhantomJS for Automated Testing
PDF
The MetaCPAN VM for Dummies Part One (Installation)
PDF
V8 javascript engine for フロントエンドデベロッパー
Gigigo Rails Workshop
How Danga::Socket handles asynchronous processing and how to write asynchrono...
Search 500-video-clips
WP Weekend #2 - Corcel, aneb WordPress přes Laravel
Perlbal Tutorial
Locarise,reagent and JavaScript Libraries
What The Flask? and how to use it with some Google APIs
Profiling PHP with Xdebug / Webgrind
Learning Svelte
Basic commands for powershell : Configuring Windows PowerShell and working wi...
No Hugging, No Learning
Introduccion app engine con python
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"
SFScon17 - Paolo D'Incau: "Build, test and release your software using Free S...
Pydata-Python tools for webscraping
#Continuous delivery with #Deployit
CasperJS and PhantomJS for Automated Testing
The MetaCPAN VM for Dummies Part One (Installation)
V8 javascript engine for フロントエンドデベロッパー
Ad

Viewers also liked (20)

PDF
Dawn - Actionscript Library
PPTX
Star Chart Power Point
PDF
【水資源機構】平成17年環境報告書
PPT
PDF
Daniel Morgenstern Variety
PPTX
Aplicaciones
PDF
睿知远见 育木成林
PDF
Geo Notes .Key
PDF
Apple Leaf Info 2010 V10.1
PPT
Alliyah W.
PPS
divertido
PPT
Thailand Peoples Participation Dialogue Final
PDF
Lively Applications Examples
PPT
PPT
Dig China Presentation Amended
PDF
Amenazas Informática
PPT
Picassa En Xtec Blog
PPT
Meie Unistuste Kool
PPT
Sinterklaas bezoekt Romae, achter de schermen
Dawn - Actionscript Library
Star Chart Power Point
【水資源機構】平成17年環境報告書
Daniel Morgenstern Variety
Aplicaciones
睿知远见 育木成林
Geo Notes .Key
Apple Leaf Info 2010 V10.1
Alliyah W.
divertido
Thailand Peoples Participation Dialogue Final
Lively Applications Examples
Dig China Presentation Amended
Amenazas Informática
Picassa En Xtec Blog
Meie Unistuste Kool
Sinterklaas bezoekt Romae, achter de schermen
Ad

Similar to Mini Curso Django Ii Congresso Academico Ces (20)

ODP
Software Project Management
ODP
Django for Beginners
ODP
Easy Web Project Development & Management with Django & Mercurial
PPTX
Django web framework
PDF
Introduction to Django
PDF
How to Webpack your Django!
PPTX
React django
PPT
DJango
PDF
Django - basics
PDF
Introduction to Django
KEY
Introduction to Django
PDF
GDG Addis - An Introduction to Django and App Engine
ODP
Introduce Django
PDF
Django Introduction & Tutorial
PDF
Build and deploy Python Django project
PDF
An Introduction to Django Web Framework
PDF
Virtual Environment and Web development using Django
PDF
Python Expense Tracker Project with Source Code.pdf
PDF
بررسی چارچوب جنگو
Software Project Management
Django for Beginners
Easy Web Project Development & Management with Django & Mercurial
Django web framework
Introduction to Django
How to Webpack your Django!
React django
DJango
Django - basics
Introduction to Django
Introduction to Django
GDG Addis - An Introduction to Django and App Engine
Introduce Django
Django Introduction & Tutorial
Build and deploy Python Django project
An Introduction to Django Web Framework
Virtual Environment and Web development using Django
Python Expense Tracker Project with Source Code.pdf
بررسی چارچوب جنگو

Mini Curso Django Ii Congresso Academico Ces

  • 1. Welcome to the Django!
  • 2. What's Django? &quot;Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.&quot;   from http://www.djangoproject.com/   &quot;...and not a CMS System.&quot;
  • 5. Origins... Pycon 2005 - Adrian Holovaty e Simon Willison BSD License* Django Software Foundation - 2008 * http://en.wikipedia.org/wiki/BSD_licenses
  • 7. Skills   Convention Over Configuration Object-Relational Mapping (ORM) Very useful admin CRUD Form handling Elegant URL Design Template system Cache system i18n      
  • 8. Principles (...or philosophies)       DRY ( Don't Repeat Yourself ) Loose coupling Write less code as possible Quick development Explicit is better than implicit        
  • 11. MVC vs. MTV       M odel --> M odel V iew --> T emplate C ontroller --> V iew
  • 13. Go to the Project!
  • 14.   Download djangoproject.com/download Install Unzip Django-x.x.tar.gz python setup.py install Or... apt-get install python-django (Debian like OS) Setting up...
  • 15. Create a Project...       django-admin.py startproject my_project
  • 16. Setup files   __init__.py - indicates a python package   manager.py - admin tasks   settings.py - project settings   urls.py - project urls map
  • 17. Let's to do something... Open settings.py : DATABASE_ENGINE = 'sqlite3' DATABASE_NAME = 'myblog.db' add 'django.contrib.admin' Open urls.py : Uncomment the line: &quot; from django.contrib... &quot; Uncomment the line: &quot; admin.autodiscover()... &quot; Uncomment the line: &quot; (r'^admin... &quot;
  • 18. Development server       python manager.py syncdb   python manager.py runserver [8000]
  • 19. Others Servers... Development Server   Apache + Mod_Python   Apache + FastCGI
  • 20. Create the app       python manage.py startapp my_blog
  • 21. Setup files     init.py - indicates a python package   models.py - app domain model   views.py - project controller
  • 22. App x Project     App - web app that do something. E.g. XXX Project - lot of apps and themselves settings. A project can be a lot of apps, and a app can stay in severals projects
  • 23. Create the model       Open models.py and edit:     from django.db import models class Artigo(models.Model): titulo = models.CharField(max_length=100) conteudo = models.TextField() publicacao = models.DateTimeField()
  • 24. Setting the model classes to admin Open admin.py and edit:       from django.contrib import admin from models import Artigo   admin.site.register(Artigo)
  • 25. Add the app to the admin     Open settings.py and add: &quot;my_project.blog&quot; Re-sync the database Re-run the development server
  • 26. Setting the urls   Open the urls.py and edit:   from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() from my_blog.models import Artigo urlpatterns = patterns('', (r'^$', 'django.views.generic.date_based.archive_index', {'queryset': Artigo.objects.all(), 'date_field': 'publicacao'}), (r'^admin/(.*)', admin.site.root), )
  • 27. Setting the templates   Create templates/blog/artigo_archive.html and edit:      <html><body> <h1>Meu blog</h1> {% for artigo in latest %} <h2>{{ artigo.titulo }}</h2> {{ artigo.conteudo }} {% endfor %} </body></html>
  • 28. Look your app!       http://localhost:8000/
  • 29. Recap...       Django is easy Django is fun Django scales Django is maintainable Django saves small kittens It rocks - USE IT! 
  • 30. Sites powered by Python/Django
  • 31.  
  • 32. Contact/follow us... [email_address] [email_address] Twitter: @leofernandesmo @felipe_wally

Editor's Notes

  • #3: * Rápida explanação do que é o Django. * Falar sobre o que o Django não é:   - Muita gente compara com o Plone.
  • #4: * Falar sobre a origem do django: -jornal de Lawrence - Kansas    - falar sobre a pycon - falar sobre licença BSD - DSF assumiu o desenvolvimento em 2008
  • #8: - Falar rapidamente sobre cada um desses conceitos
  • #9: Essas informações podem ser estudadas aqui -&gt; http://docs.djangobrasil.org/misc/design-philosophies.html#misc-design-philosophies   - Falar sobre DRY - Sobre Baixo Acoplamento - Sobre Escrever menos código - Sobre Desenvolvimento Ágil - Sobre Explicito é melhor que implicito
  • #10: !!!
  • #11: - explicar MVC - explicar MTV
  • #12: - explicar MVC - explicar MTV
  • #15: 1 - Pede para os participantes digitarem &apos;python&apos; no console...(se linux, td ok) 2 - ...depois para digitar &gt;&gt;import django (aparecerá erro) 3 - Caso tenha internet, baixar o django via &amp;quot;apt-get&amp;quot; ou do site (descompactar e instalar usando: python setup.py install). 4 - repetir passo 2
  • #16: 1 – Segue os passos para criar um projeto 2 – Pede aos participantes para conferir a pasta criada.
  • #17: 3 - ...falar brevemente sobre os arquivos criados.     Comentar novamente conven. over config.
  • #18: 1 – Falar sobre a utilizadade do settings.py 2 – Explicar as principais configurações 3 – Altera dados do banco, time_zone, language_code... 4 – Alterar o TEMPLATE_DIRS para similar ao usado na Fapeal.     Obs.  Lembrar que é um arquivo python e pode-se usar diversas praticipdades. 5 – Colocar as configurações para o admin (TODO – Ver na Fapeal) -------------------------------- 6 – Falar sobre o urls.py 7 – Descomentar as linhas para o admin. (lembrar dos espaçoes em branco ...identação Python) 8 – Sincronizar o banco de dados para gerar o banco     Lembrar de criar um super usuario
  • #19: 4 – Pedir para rodar o servidor embutido   5 - Conferir se o servidor está rodando acessando pelo browser (http://localhost:8000)    6 - acessar o admin no browser e mostrar as funcionalidades
  • #20: 1 - Falar brevemente dos possíveis métodos para servidores de produção
  • #21: 9 – Pede aos participantes para criar a aplicação. 10 – Falar sobre os arquivos criados     models.py     tests.py     views.py 11 – Criar arquivo admin.py e colocar&gt; from django.contrib import admin from models import Artigo admin.site.register(Artigo) 12 – Alterar novamente o settings para adicionar a app criada 13 – Sincronizar o bd...
  • #22: 10 – Falar brevemente sobre os arquivos criados     models.py     tests.py     views.py
  • #23: Falar da diferença entre aplicação e projeto
  • #26: 1 - falar do re-sync e do re-run 2 - cadastrar alguns artigos para visualização
  • #30: - falar do ACPB
  • #31: - falar do ACPB