SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Django 101
     Robert Coup
http://rob.coup.net.nz/
What is Django?

“    The Web framework for perfectionists
     with deadlines


    Django makes it easier to build better Web
    apps more quickly and with less code
              www.djangoproject.com
Who am I?
• Robert Coup
• CTO of Koordinates
  - making geospatial data more accessible
  - http://koordinates.com
• OSS contributor
• 2 year Djangonaut
• robert@coup.net.nz
What’s it for?

• Building dynamic Web sites
• A high level Web framework
• Abstracts common problems
• Shortcuts for fast development
Key Features
• nice url handling
• object : db mapping
• forms
• templating
• admin interface
•   caching, syndication, middleware, email, sql, modules, authentication, sessions,
    comments, sitemaps, gis, …
So? And?

• work at a nice abstraction level
• just Python, no magic
• gets out of your way
Architecture

• “MVT”
• Models describe your data
• Views control what a user sees and does
• Templates are what they see
Sample App - Yachties

• Yacht racing crews
• Schedule of races
• Notify and Invite crew to races
• Know who’s coming
Install Django

• Database: Sqlite, Postgres, MySQL, Oracle
• Web: Apache, FastCGI, wsgi, dev-server
• Use Trunk, checkout from SVN
 • www.djangoproject.com/download
• python   setup.py install
Projects and Apps

• django-admin   startproject yachties
• cd yachties
• django-admin   startapp racing
Models

• models.py
• describes the fields
• turned into database tables
• the logic and rules of the application
Settings


• settings.py
• Just a Python file
Databases

• Django will create your tables for you
• python   manage.py syncdb

• Additional SQL commands:
  • python   manage.py sql*

• Ability to preload data
Shell

• python manage.py shell
• from yachties.racing.models   import
  Race

• Manipulate your models live
Server


• Server for development & debugging
•   python manage.py runserver

• http://localhost:8000/
Automatic Admin Site

• Built dynamically from your models
• Authentication & validation
• Flexible and customisable
URL Handling

• All in urls.py
• Separates views from how they’re called
• Just regular expressions
Views

• The “controller”
• Just Python functions
 • that take a request
 • and return a response
Templates


• What the user sees
• No code
Templates

• Pulls data from a dictionary (“context”)
• Simple logic constructs (“tags”)
• Simple data manipulation (“filters”)
• Inheritance
More

• Form generation & handling
• Contrib apps:
 • builtin: admin, forms, gis, feeds,
 • 3 party: see Google Code
     rd


• Any Python code will work with Django
Support

• Quality documentation
• Django Book www.djangobook.com
• www.djangosnippets.org
• Mailing lists, IRC
Google App Engine

• Google’s “cloud computing” platform
• Python based
• Runs Django
• Modified model layer
• http://code.google.com/appengine/
Sites

• Lots of news/journalism sites
• Washington Post
• Pownce
• Koordinates
• www.djangosites.org
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

W3C Web Performance - A detailed overview
W3C Web Performance - A detailed overviewW3C Web Performance - A detailed overview
W3C Web Performance - A detailed overview
Alois Reitbauer
 

Was ist angesagt? (11)

GTM container positions: a summary of best & worst
GTM container positions: a summary of best & worstGTM container positions: a summary of best & worst
GTM container positions: a summary of best & worst
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
 
W3C Web Performance - A detailed overview
W3C Web Performance - A detailed overviewW3C Web Performance - A detailed overview
W3C Web Performance - A detailed overview
 
Java script templating in wordpress
Java script templating in wordpressJava script templating in wordpress
Java script templating in wordpress
 
Towards component based web UI with ReactJS
Towards component based web UI with ReactJSTowards component based web UI with ReactJS
Towards component based web UI with ReactJS
 
Php laravel training
Php laravel trainingPhp laravel training
Php laravel training
 
Service workers - Forza lavoro al servizio della tua Performance
Service workers - Forza lavoro al servizio della tua PerformanceService workers - Forza lavoro al servizio della tua Performance
Service workers - Forza lavoro al servizio della tua Performance
 
Performance with Selenium2
Performance with Selenium2Performance with Selenium2
Performance with Selenium2
 
High Performance Kick Ass Web Apps (JavaScript edition)
High Performance Kick Ass Web Apps (JavaScript edition)High Performance Kick Ass Web Apps (JavaScript edition)
High Performance Kick Ass Web Apps (JavaScript edition)
 
Guide To Web Development
Guide To Web DevelopmentGuide To Web Development
Guide To Web Development
 
SQL Server - CLR integration
SQL Server - CLR integrationSQL Server - CLR integration
SQL Server - CLR integration
 

Ähnlich wie Django 101

Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
PerconaPerformance
 
iPhone Development For Experienced Web Developers
iPhone Development For Experienced Web DevelopersiPhone Development For Experienced Web Developers
iPhone Development For Experienced Web Developers
lisab517
 
PHX Session #1: Development Best Practices And How Microsoft Helps
PHX Session #1: Development  Best  Practices And  How  Microsoft  HelpsPHX Session #1: Development  Best  Practices And  How  Microsoft  Helps
PHX Session #1: Development Best Practices And How Microsoft Helps
Steve Lange
 
Frank Mantek Google G Data
Frank Mantek Google G DataFrank Mantek Google G Data
Frank Mantek Google G Data
deimos
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
oscon2007
 

Ähnlich wie Django 101 (20)

Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
 
Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009
 
Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009
 
iPhone Development For Experienced Web Developers
iPhone Development For Experienced Web DevelopersiPhone Development For Experienced Web Developers
iPhone Development For Experienced Web Developers
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
 
Ajax World West
Ajax World WestAjax World West
Ajax World West
 
PHX Session #1: Development Best Practices And How Microsoft Helps
PHX Session #1: Development  Best  Practices And  How  Microsoft  HelpsPHX Session #1: Development  Best  Practices And  How  Microsoft  Helps
PHX Session #1: Development Best Practices And How Microsoft Helps
 
django
djangodjango
django
 
Introduction to Web Development with Ruby on Rails
Introduction to Web Development with Ruby on RailsIntroduction to Web Development with Ruby on Rails
Introduction to Web Development with Ruby on Rails
 
Mojomojo Talk
Mojomojo TalkMojomojo Talk
Mojomojo Talk
 
Magee Dday2 Fixing App Performance Italiano
Magee Dday2 Fixing App Performance ItalianoMagee Dday2 Fixing App Performance Italiano
Magee Dday2 Fixing App Performance Italiano
 
Qure Tech Presentation
Qure Tech PresentationQure Tech Presentation
Qure Tech Presentation
 
Instant J Chem: one-stop information hub for medicinal chemists: US UGM 2008
Instant J Chem: one-stop information hub for medicinal chemists: US UGM 2008Instant J Chem: one-stop information hub for medicinal chemists: US UGM 2008
Instant J Chem: one-stop information hub for medicinal chemists: US UGM 2008
 
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech FestStatic Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
 
Perfmon And Profiler 101
Perfmon And Profiler 101Perfmon And Profiler 101
Perfmon And Profiler 101
 
Frank Mantek Google G Data
Frank Mantek Google G DataFrank Mantek Google G Data
Frank Mantek Google G Data
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
 
Spring insight what just happened
Spring insight   what just happenedSpring insight   what just happened
Spring insight what just happened
 
Scaling Magento
Scaling MagentoScaling Magento
Scaling Magento
 
From HTML to pixels on the Screen
From HTML to pixels on the ScreenFrom HTML to pixels on the Screen
From HTML to pixels on the Screen
 

Mehr von Robert Coup

Mehr von Robert Coup (9)

Curtailing Crustaceans with Geeky Enthusiasm
Curtailing Crustaceans with Geeky EnthusiasmCurtailing Crustaceans with Geeky Enthusiasm
Curtailing Crustaceans with Geeky Enthusiasm
 
Monitoring and Debugging your Live Applications
Monitoring and Debugging your Live ApplicationsMonitoring and Debugging your Live Applications
Monitoring and Debugging your Live Applications
 
/me wants it. Scraping sites to get data.
/me wants it. Scraping sites to get data./me wants it. Scraping sites to get data.
/me wants it. Scraping sites to get data.
 
Map Analytics - Ignite Spatial
Map Analytics - Ignite SpatialMap Analytics - Ignite Spatial
Map Analytics - Ignite Spatial
 
Twisted: a quick introduction
Twisted: a quick introductionTwisted: a quick introduction
Twisted: a quick introduction
 
Distributed-ness: Distributed computing & the clouds
Distributed-ness: Distributed computing & the cloudsDistributed-ness: Distributed computing & the clouds
Distributed-ness: Distributed computing & the clouds
 
Geo-Processing in the Clouds
Geo-Processing in the CloudsGeo-Processing in the Clouds
Geo-Processing in the Clouds
 
Maps are Fun - Why not on the web?
Maps are Fun - Why not on the web?Maps are Fun - Why not on the web?
Maps are Fun - Why not on the web?
 
Fame and Fortune from Open Source
Fame and Fortune from Open SourceFame and Fortune from Open Source
Fame and Fortune from Open Source
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 

Django 101

  • 1. Django 101 Robert Coup http://rob.coup.net.nz/
  • 2. What is Django? “ The Web framework for perfectionists with deadlines Django makes it easier to build better Web apps more quickly and with less code www.djangoproject.com
  • 3. Who am I? • Robert Coup • CTO of Koordinates - making geospatial data more accessible - http://koordinates.com • OSS contributor • 2 year Djangonaut • robert@coup.net.nz
  • 4. What’s it for? • Building dynamic Web sites • A high level Web framework • Abstracts common problems • Shortcuts for fast development
  • 5. Key Features • nice url handling • object : db mapping • forms • templating • admin interface • caching, syndication, middleware, email, sql, modules, authentication, sessions, comments, sitemaps, gis, …
  • 6. So? And? • work at a nice abstraction level • just Python, no magic • gets out of your way
  • 7. Architecture • “MVT” • Models describe your data • Views control what a user sees and does • Templates are what they see
  • 8. Sample App - Yachties • Yacht racing crews • Schedule of races • Notify and Invite crew to races • Know who’s coming
  • 9. Install Django • Database: Sqlite, Postgres, MySQL, Oracle • Web: Apache, FastCGI, wsgi, dev-server • Use Trunk, checkout from SVN • www.djangoproject.com/download • python setup.py install
  • 10. Projects and Apps • django-admin startproject yachties • cd yachties • django-admin startapp racing
  • 11. Models • models.py • describes the fields • turned into database tables • the logic and rules of the application
  • 13. Databases • Django will create your tables for you • python manage.py syncdb • Additional SQL commands: • python manage.py sql* • Ability to preload data
  • 14. Shell • python manage.py shell • from yachties.racing.models import Race • Manipulate your models live
  • 15. Server • Server for development & debugging • python manage.py runserver • http://localhost:8000/
  • 16. Automatic Admin Site • Built dynamically from your models • Authentication & validation • Flexible and customisable
  • 17. URL Handling • All in urls.py • Separates views from how they’re called • Just regular expressions
  • 18. Views • The “controller” • Just Python functions • that take a request • and return a response
  • 19. Templates • What the user sees • No code
  • 20. Templates • Pulls data from a dictionary (“context”) • Simple logic constructs (“tags”) • Simple data manipulation (“filters”) • Inheritance
  • 21. More • Form generation & handling • Contrib apps: • builtin: admin, forms, gis, feeds, • 3 party: see Google Code rd • Any Python code will work with Django
  • 22. Support • Quality documentation • Django Book www.djangobook.com • www.djangosnippets.org • Mailing lists, IRC
  • 23. Google App Engine • Google’s “cloud computing” platform • Python based • Runs Django • Modified model layer • http://code.google.com/appengine/
  • 24. Sites • Lots of news/journalism sites • Washington Post • Pownce • Koordinates • www.djangosites.org

Hinweis der Redaktion