SlideShare una empresa de Scribd logo
1 de 35
Descargar para leer sin conexión
This talk is about Django, my favourite web framework. I’m Emil Stenström, I work for 
a company called Valtech, and we are looking for developers. Please e‐mail 
emil.stenstrom@valtech.se if you are interested. 




                                                                                         1 
I have tried these tools, but none of them really made me love working with them. 




                                                                                     2 
This is how Django works, and this is really all you need to know about Django’s inner 
workings. The blue boxes are what things are called, the purple ones is a try to be 
more concrete in what they mean. Lets go through each box. 




                                                                                          3 
This is a full url configuraLon file. To the leM you have a list of regular expressions, to 
the right you have a list of funcLons to run when an URL matches that regexp. Every 
pair of parentesis inside the regexps are variables that are sent as arguments to the 
view. 




                                                                                             4 
And this is a view. But you can’t have html in the code like that can you? 




                                                                              5 
BeUer send your informaLon to a template like this. You can send any number of 
variables, of any type, to your template. 




                                                                                  6 
And this is how the template looks. Use dot‐syntax to access properLes, and for‐loops 
to access things in lists. Pipe chars, |, can be used for filter variables (in this case 
”upper” is a filter) and django comes with a very good list of default filters. 




                                                                                           7 
And this is the rendered HTML. But we have missed one step now, haven’t we? The 
model... 




                                                                                   8 
The model! This is what you need to do to store informaLon about a person. Just list 
the fields you want, there are many field types to choose from. When you’re done, go 
to the console and type the line at the boUom. Voilá, your model is ready to use... 




                                                                                        9 
This is how you use your model. The all() funcLon is just one of many ways to access 
model objects. 




                                                                                        10 
Another way is get(), which fetches a specific field for your based on the parameters 
you send to it. The name parameter comes from the url config. Remember the 
parentesis? 




                                                                                       11 
So that’s it, now you know everything you need to know about django’s funcLonallity. 
But now we’ve only talked about output. How do you insert data into the database 
then? 




                                                                                        12 
By using Djangos automaLc interface. It looks at your model and just renders an 
interface based on that informaLon. This interface is also highly configurable. Click on 
Books. 




                                                                                           13 
Clicked ”the Django Book”.  




                               14 
Based on the model the admin also knows how to render the controls for that field. 
Nice, isn’t it? But what if you don’t want to use the admin, for instance if you need a 
comment field? 




                                                                                           15 
So this is how you make a form in django. Looks preUy similar to how you create a 
model right? 




                                                                                     16 
Well, a liUle too similar. So this is how you can automaLcally generate it from a model 
if you want to. 




                                                                                           17 
And this is how you process that form in a view. The # is a comment, and also the 
place where you decide what you want to do with your data. Send an e‐mail? Save it 
to the database? 




                                                                                      18 
This is how you render a form. The as_p funcLon renders it as <p> tags. You can also 
choose to render it as a unordered list (as_ul) or as a table (as_table). How bad is the 
code generated then? 




                                                                                            19 
Not bad at all. It has all the liUle quicks interface developers want it to have. You like 
it?  




                                                                                              20 
Yes, it does perform. Don’t be afraid of python, your database is much slower than 
python is. So you should instead concentrate in lemng the database work as liUle as 
possible. How? 




                                                                                       21 
By using caching. Python has four levels of caching, and the first one is on the site 
level. These two lines in the semngs file enables cache on all pages without get and 
post parameters. 




                                                                                        22 
If that’s too rough you can also cache on the view level. The cache_page thingie takes 
the number of seconds to cache. 




                                                                                          23 
And if that’s too rough you can do it on the template level instead. The string aMer 
the number of seconds is just a name that idenLfies this cached block. 




                                                                                        24 
Or if you really like the gory details, you can go right at the core of things. Django 
gives you geUers and seUers directly at the cache that you can use from your views. 
All of these caching backends goes against the same backend, a semng. Supported 
backends are Memcached, File system, Database, Memory and a couple of strange 
ones. 




                                                                                          25 
I could talk all night about the different parts of django, but I won’t. Just trust me that 
they are as good as what you’ve seen this far. So now you probably wonder, what 
sites use Django? 




                                                                                              26 
The last two onces are my own projects. Boktraven is not done yet, and I’m building 
an intranet for Valtech that’s obviously not accessible from the outside. You would 
have liked that wouldn’t you? Over all, I would like more big sites to use Django, it 
would make it easier to convince clients to use it. So what do I think about Django, 
what are my opinions about it? 




                                                                                         27 
Well, it’s uncomfortable at first. 




                                     28 
But then you realize that it’s actually quite easy to use. 




                                                              29 
But the real reason for using Django is because it’s fun. I haven’t felt that about any 
other product or framework I’ve tried. This is the reason why I’m holding this 
presentaLon tonight. I would never have held it about Sharepoint. 




                                                                                           30 
One of the best things about Django is its documentaLon. It rocks. Really.  




                                                                               31 
Also, it’s much more hip than Rails. 




                                        32 
HosLng is sLll a problem. Although the few hosts that support it does it well 
(Compare with the sea view below).  




                                                                                 33 
Django is also under acLve development, and new features are based on real needs, 
not a need to write a “complete framework”. A framework that concentrates on 
solving your problems quickly, that’s Django.  




                                                                                     34 
35 

Más contenido relacionado

Destacado

Humour Coquin Gc 1
Humour Coquin Gc 1Humour Coquin Gc 1
Humour Coquin Gc 1labrador
 
Ciclos Em Nossas Vidas
Ciclos Em Nossas VidasCiclos Em Nossas Vidas
Ciclos Em Nossas Vidasdiliaoliveira
 
Comparing Java Web Frameworks Apache Con Eu2007
Comparing Java Web Frameworks Apache Con Eu2007Comparing Java Web Frameworks Apache Con Eu2007
Comparing Java Web Frameworks Apache Con Eu2007Yekmer Simsek
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 
Comparing JVM Web Frameworks - Rich Web Experience 2010
Comparing JVM Web Frameworks - Rich Web Experience 2010Comparing JVM Web Frameworks - Rich Web Experience 2010
Comparing JVM Web Frameworks - Rich Web Experience 2010Matt Raible
 
Alignment By Design - Body of Knowledge
Alignment By Design - Body of KnowledgeAlignment By Design - Body of Knowledge
Alignment By Design - Body of KnowledgeThomas Bradley
 

Destacado (10)

Humour Coquin Gc 1
Humour Coquin Gc 1Humour Coquin Gc 1
Humour Coquin Gc 1
 
Phone Itinerary[1]
Phone Itinerary[1]Phone Itinerary[1]
Phone Itinerary[1]
 
Navegador Web
Navegador WebNavegador Web
Navegador Web
 
Nada é Impossivel
Nada é ImpossivelNada é Impossivel
Nada é Impossivel
 
Ciclos Em Nossas Vidas
Ciclos Em Nossas VidasCiclos Em Nossas Vidas
Ciclos Em Nossas Vidas
 
Projeto Pérola
Projeto PérolaProjeto Pérola
Projeto Pérola
 
Comparing Java Web Frameworks Apache Con Eu2007
Comparing Java Web Frameworks Apache Con Eu2007Comparing Java Web Frameworks Apache Con Eu2007
Comparing Java Web Frameworks Apache Con Eu2007
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Comparing JVM Web Frameworks - Rich Web Experience 2010
Comparing JVM Web Frameworks - Rich Web Experience 2010Comparing JVM Web Frameworks - Rich Web Experience 2010
Comparing JVM Web Frameworks - Rich Web Experience 2010
 
Alignment By Design - Body of Knowledge
Alignment By Design - Body of KnowledgeAlignment By Design - Body of Knowledge
Alignment By Design - Body of Knowledge
 

Similar a Django The Fun Framework

yet another rails
yet another railsyet another rails
yet another railsashok kumar
 
Scaling Rails Presentation
Scaling Rails PresentationScaling Rails Presentation
Scaling Rails Presentationeraz
 
Xlab #2: wzorce projektowe
Xlab #2: wzorce projektoweXlab #2: wzorce projektowe
Xlab #2: wzorce projektoweXSolve
 
Intro To Django
Intro To DjangoIntro To Django
Intro To DjangoUdi Bauman
 
Blueprint talk at Open Hackday London 2009
Blueprint talk at Open Hackday London 2009Blueprint talk at Open Hackday London 2009
Blueprint talk at Open Hackday London 2009Ricardo Varela
 
The Ultimate Guide to Scrapebox - The Only Scrapebox Tutorial You Need
The Ultimate Guide to Scrapebox - The Only Scrapebox Tutorial You NeedThe Ultimate Guide to Scrapebox - The Only Scrapebox Tutorial You Need
The Ultimate Guide to Scrapebox - The Only Scrapebox Tutorial You Needfrankmo920
 
Panther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsersPanther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsersLes-Tilleuls.coop
 
How Wiley Uses Word to Invite Authors, Engage Editors, Improve Production, an...
How Wiley Uses Word to Invite Authors, Engage Editors, Improve Production, an...How Wiley Uses Word to Invite Authors, Engage Editors, Improve Production, an...
How Wiley Uses Word to Invite Authors, Engage Editors, Improve Production, an...toc
 
Future proofing design work with Web components
Future proofing design work with Web componentsFuture proofing design work with Web components
Future proofing design work with Web componentsbtopro
 
Django vs Laravel Which Backend Framework is Better & Why.pdf
Django vs Laravel Which Backend Framework is Better & Why.pdfDjango vs Laravel Which Backend Framework is Better & Why.pdf
Django vs Laravel Which Backend Framework is Better & Why.pdfTemok IT Services
 
True beauty is on the inside, but your users are shallow.
True beauty is on the inside, but your users are shallow.True beauty is on the inside, but your users are shallow.
True beauty is on the inside, but your users are shallow.Loek van Gent
 
Scalability without going nuts
Scalability without going nutsScalability without going nuts
Scalability without going nutsJames Cox
 
Java to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.ioJava to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.ioMauricio (Salaboy) Salatino
 

Similar a Django The Fun Framework (20)

yet another rails
yet another railsyet another rails
yet another rails
 
Scaling Rails Presentation
Scaling Rails PresentationScaling Rails Presentation
Scaling Rails Presentation
 
Scaling Scribd
Scaling ScribdScaling Scribd
Scaling Scribd
 
Introduce Django
Introduce DjangoIntroduce Django
Introduce Django
 
Xlab #2: wzorce projektowe
Xlab #2: wzorce projektoweXlab #2: wzorce projektowe
Xlab #2: wzorce projektowe
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
 
Blueprint talk at Open Hackday London 2009
Blueprint talk at Open Hackday London 2009Blueprint talk at Open Hackday London 2009
Blueprint talk at Open Hackday London 2009
 
jQuery quick tips
jQuery quick tipsjQuery quick tips
jQuery quick tips
 
The Ultimate Guide to Scrapebox - The Only Scrapebox Tutorial You Need
The Ultimate Guide to Scrapebox - The Only Scrapebox Tutorial You NeedThe Ultimate Guide to Scrapebox - The Only Scrapebox Tutorial You Need
The Ultimate Guide to Scrapebox - The Only Scrapebox Tutorial You Need
 
Panther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsersPanther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsers
 
Js basics
Js basicsJs basics
Js basics
 
Wordpress Guide
Wordpress GuideWordpress Guide
Wordpress Guide
 
How Wiley Uses Word to Invite Authors, Engage Editors, Improve Production, an...
How Wiley Uses Word to Invite Authors, Engage Editors, Improve Production, an...How Wiley Uses Word to Invite Authors, Engage Editors, Improve Production, an...
How Wiley Uses Word to Invite Authors, Engage Editors, Improve Production, an...
 
Future proofing design work with Web components
Future proofing design work with Web componentsFuture proofing design work with Web components
Future proofing design work with Web components
 
Django vs Laravel Which Backend Framework is Better & Why.pdf
Django vs Laravel Which Backend Framework is Better & Why.pdfDjango vs Laravel Which Backend Framework is Better & Why.pdf
Django vs Laravel Which Backend Framework is Better & Why.pdf
 
Forensic Theming - DrupalCon London
Forensic Theming - DrupalCon LondonForensic Theming - DrupalCon London
Forensic Theming - DrupalCon London
 
Django Girls Tutorial
Django Girls TutorialDjango Girls Tutorial
Django Girls Tutorial
 
True beauty is on the inside, but your users are shallow.
True beauty is on the inside, but your users are shallow.True beauty is on the inside, but your users are shallow.
True beauty is on the inside, but your users are shallow.
 
Scalability without going nuts
Scalability without going nutsScalability without going nuts
Scalability without going nuts
 
Java to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.ioJava to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.io
 

Último

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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 educationjfdjdjcjdnsjd
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
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)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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...Drew Madelung
 
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 FMESafe Software
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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 DevelopmentsTrustArc
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
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 WorkerThousandEyes
 
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 TerraformAndrey Devyatkin
 

Último (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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...
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
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
 

Django The Fun Framework