SlideShare a Scribd company logo
1 of 23
Download to read offline
Django Worst Practices
                          Daniel Greenfeld




Tuesday, April 19, 2011
Django Worst Practices

                           Whole
                          project in
                           one app



Tuesday, April 19, 2011
Django Worst Practices

                           Whole
                          project in
                           one app

                               All your stuff in one place!


Tuesday, April 19, 2011
Django Worst Practices

                           Whole
                          project in
                           one app

                     All your stuff in one place!
          No need to worry about bugfixes or enhancements!
Tuesday, April 19, 2011
Django Worst Practices
  pydanny: pwd
  /Users/pydanny/projects/enterprise/settings
  pydanny: ls -l
  total 24
  -rw-r--r-- 1 pydanny staff 0 Apr 18 22:38 __init__.py
  lrwxr-xr-x 1 pydanny staff 21 Apr 18 22:42 dev.py -> /Users/pydanny/dev.py
  lrwxr-xr-x 1 pydanny staff 22 Apr 18 22:42 prod.py -> /Users/pydanny/prod.py
  lrwxr-xr-x 1 pydanny staff 25 Apr 18 22:42 staging.py -> /Users/pydanny/staging.py


                Symlink your settings folder!
                          Cause you’ll remember to do this with each server setup...




Tuesday, April 19, 2011
Django Worst Practices
                          Database Choices




Tuesday, April 19, 2011
Django Worst Practices
                              Database Choices
                     • Use a relational database to store ill-
                          defined hierarchical data!




Tuesday, April 19, 2011
Django Worst Practices
                              Database Choices
                     • Use a relational database to store ill-
                          defined hierarchical data!
                     • Use NoSQL to store tabular data!


Tuesday, April 19, 2011
Django Worst Practices
                          <%python scope="global">
                              # declare global variables, accessible
                              # across this component's generated module

                              message1 = "this is message one."
                              message2 = "this is message two."
                              message3 = "doh, im message three."
                          </%python>

                          <%python>
                              # reference the global variables
                              m.write("message one: " + message1)
                              m.write("message two: " + message2)

                              # we want to assign to message3,
                              # so declare "global" first
                              global message3

                              message3 = "this is message three."

                              m.write("message three: " + message3)

                          </%python>




Tuesday, April 19, 2011
Django Worst Practices
                          <%python scope="global">
                              # declare global variables, accessible
                              # across this component's generated module

                              message1 = "this is message one."
                              message2 = "this is message two."
                              message3 = "doh, im message three."
                          </%python>

                          <%python>
                              # reference the global variables
                              m.write("message one: " + message1)
                              m.write("message two: " + message2)

                              # we want to assign to message3,
                              # so declare "global" first
                              global message3

                              message3 = "this is message three."

                              m.write("message three: " + message3)

                          </%python>


                          Who needs caching?



Tuesday, April 19, 2011
Django Worst Practices
                             <%python scope="global">
                                 # declare global variables, accessible
                                 # across this component's generated module

                                 message1 = "this is message one."
                                 message2 = "this is message two."
                                 message3 = "doh, im message three."
                             </%python>

                             <%python>
                                 # reference the global variables
                                 m.write("message one: " + message1)
                                 m.write("message two: " + message2)

                                 # we want to assign to message3,
                                 # so declare "global" first
                                 global message3

                                 message3 = "this is message three."

                                 m.write("message three: " + message3)

                             </%python>


                             Who needs caching?
                          Performance awesomeness!

Tuesday, April 19, 2011
Django Worst Practices
                                <%python scope="global">
                                    # declare global variables, accessible
                                    # across this component's generated module

                                    message1 = "this is message one."
                                    message2 = "this is message two."
                                    message3 = "doh, im message three."
                                </%python>

                                <%python>
                                    # reference the global variables
                                    m.write("message one: " + message1)
                                    m.write("message two: " + message2)

                                    # we want to assign to message3,
                                    # so declare "global" first
                                    global message3

                                    message3 = "this is message three."

                                    m.write("message three: " + message3)

                                </%python>


                                Who needs caching?
                            Performance awesomeness!
                          Replaces pesky django templates!
Tuesday, April 19, 2011
Django Worst Practices
                                <%python scope="global">
                                    # declare global variables, accessible
                                    # across this component's generated module

                                    message1 = "this is message one."
                                    message2 = "this is message two."
                                    message3 = "doh, im message three."
                                </%python>

                                <%python>
                                    # reference the global variables
                                    m.write("message one: " + message1)
                                    m.write("message two: " + message2)

                                    # we want to assign to message3,
                                    # so declare "global" first
                                    global message3

                                    message3 = "this is message three."

                                    m.write("message three: " + message3)

                                </%python>


                                Who needs caching?
                            Performance awesomeness!
                          Replaces pesky django templates!
Tuesday, April 19, 2011
Django Worst Practices
                            <?xml version="1.0" encoding="UTF-8"?>
                            <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
                              <xsl:output method="xml" indent="yes"/>

                              <xsl:template match="/persons">
                                <root>
                                  <xsl:apply-templates select="person"/>
                                </root>
                              </xsl:template>

                              <xsl:template match="person">
                                <name username="{@username}">
                                  <xsl:value-of select="name" />
                                </name>
                              </xsl:template>

                            </xsl:stylesheet>




                          Use XSLT for awesome performance!


Tuesday, April 19, 2011
Django Worst Practices
                          Put critical business logic in...




Tuesday, April 19, 2011
Django Worst Practices
                          Put critical business logic in...

                                  • The templates




Tuesday, April 19, 2011
Django Worst Practices
                          Put critical business logic in...

                                  • The templates
                                  • settings




Tuesday, April 19, 2011
Django Worst Practices
                          Put critical business logic in...

                                  • The templates
                                  • settings
                                  • The context processors



Tuesday, April 19, 2011
Django Worst Practices
                          Put critical business logic in...

                                  •   The templates
                                  •   settings
                                  •   The context processors
                                  •   Middleware!



Tuesday, April 19, 2011
Django Worst Practices


                          Use metaclasses instead of abstract models!




Tuesday, April 19, 2011
Django Worst Practices
   In settings:
                from django.db import models
                blog2_fields = [
                          models.CharField(“title”, max_length=50),
                          models.TextField(“note”)
                ]

Tuesday, April 19, 2011
Django Worst Practices

                           Present using
                           Different fonts
                             Dark text
                          Dire backgrounds

Tuesday, April 19, 2011
Django Worst Practices
                                       Don’t use



                          http://djangopackages.com

                               Invent everything yourself!



Tuesday, April 19, 2011

More Related Content

More from Daniel Greenfeld

How to Write a Popular Python Library by Accident
How to Write a Popular Python Library by AccidentHow to Write a Popular Python Library by Accident
How to Write a Popular Python Library by AccidentDaniel Greenfeld
 
10 more-things-you-can-do-with-python
10 more-things-you-can-do-with-python10 more-things-you-can-do-with-python
10 more-things-you-can-do-with-pythonDaniel Greenfeld
 
From NASA to Startups to Big Commerce
From NASA to Startups to Big CommerceFrom NASA to Startups to Big Commerce
From NASA to Startups to Big CommerceDaniel Greenfeld
 
Thinking hard about_python
Thinking hard about_pythonThinking hard about_python
Thinking hard about_pythonDaniel Greenfeld
 
Intro to Data Visualizations
Intro to Data VisualizationsIntro to Data Visualizations
Intro to Data VisualizationsDaniel Greenfeld
 
An Extreme Talk about the Zen of Python
An Extreme Talk about the Zen of PythonAn Extreme Talk about the Zen of Python
An Extreme Talk about the Zen of PythonDaniel Greenfeld
 
PyCon Philippines 2012 Keynote
PyCon Philippines 2012 KeynotePyCon Philippines 2012 Keynote
PyCon Philippines 2012 KeynoteDaniel Greenfeld
 
Round pegs and square holes
Round pegs and square holesRound pegs and square holes
Round pegs and square holesDaniel Greenfeld
 
Lighting talk on django-social-auth
Lighting talk on django-social-authLighting talk on django-social-auth
Lighting talk on django-social-authDaniel Greenfeld
 
Advanced Django Forms Usage
Advanced Django Forms UsageAdvanced Django Forms Usage
Advanced Django Forms UsageDaniel Greenfeld
 
Confessions of Joe Developer
Confessions of Joe DeveloperConfessions of Joe Developer
Confessions of Joe DeveloperDaniel Greenfeld
 
Pinax Long Tutorial Slides
Pinax Long Tutorial SlidesPinax Long Tutorial Slides
Pinax Long Tutorial SlidesDaniel Greenfeld
 

More from Daniel Greenfeld (20)

How to Write a Popular Python Library by Accident
How to Write a Popular Python Library by AccidentHow to Write a Popular Python Library by Accident
How to Write a Popular Python Library by Accident
 
10 more-things-you-can-do-with-python
10 more-things-you-can-do-with-python10 more-things-you-can-do-with-python
10 more-things-you-can-do-with-python
 
From NASA to Startups to Big Commerce
From NASA to Startups to Big CommerceFrom NASA to Startups to Big Commerce
From NASA to Startups to Big Commerce
 
Thinking hard about_python
Thinking hard about_pythonThinking hard about_python
Thinking hard about_python
 
Intro to Data Visualizations
Intro to Data VisualizationsIntro to Data Visualizations
Intro to Data Visualizations
 
An Extreme Talk about the Zen of Python
An Extreme Talk about the Zen of PythonAn Extreme Talk about the Zen of Python
An Extreme Talk about the Zen of Python
 
PyCon Philippines 2012 Keynote
PyCon Philippines 2012 KeynotePyCon Philippines 2012 Keynote
PyCon Philippines 2012 Keynote
 
Round pegs and square holes
Round pegs and square holesRound pegs and square holes
Round pegs and square holes
 
Intro
IntroIntro
Intro
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Lighting talk on django-social-auth
Lighting talk on django-social-authLighting talk on django-social-auth
Lighting talk on django-social-auth
 
Future of Collaboration
Future of CollaborationFuture of Collaboration
Future of Collaboration
 
Advanced Django Forms Usage
Advanced Django Forms UsageAdvanced Django Forms Usage
Advanced Django Forms Usage
 
The One Way
The One WayThe One Way
The One Way
 
Confessions of Joe Developer
Confessions of Joe DeveloperConfessions of Joe Developer
Confessions of Joe Developer
 
Python Worst Practices
Python Worst PracticesPython Worst Practices
Python Worst Practices
 
How to sell django panel
How to sell django panelHow to sell django panel
How to sell django panel
 
Pinax Long Tutorial Slides
Pinax Long Tutorial SlidesPinax Long Tutorial Slides
Pinax Long Tutorial Slides
 
Testing In Django
Testing In DjangoTesting In Django
Testing In Django
 
Django Uni-Form
Django Uni-FormDjango Uni-Form
Django Uni-Form
 

Recently uploaded

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Django Worst Practices

  • 1. Django Worst Practices Daniel Greenfeld Tuesday, April 19, 2011
  • 2. Django Worst Practices Whole project in one app Tuesday, April 19, 2011
  • 3. Django Worst Practices Whole project in one app All your stuff in one place! Tuesday, April 19, 2011
  • 4. Django Worst Practices Whole project in one app All your stuff in one place! No need to worry about bugfixes or enhancements! Tuesday, April 19, 2011
  • 5. Django Worst Practices pydanny: pwd /Users/pydanny/projects/enterprise/settings pydanny: ls -l total 24 -rw-r--r-- 1 pydanny staff 0 Apr 18 22:38 __init__.py lrwxr-xr-x 1 pydanny staff 21 Apr 18 22:42 dev.py -> /Users/pydanny/dev.py lrwxr-xr-x 1 pydanny staff 22 Apr 18 22:42 prod.py -> /Users/pydanny/prod.py lrwxr-xr-x 1 pydanny staff 25 Apr 18 22:42 staging.py -> /Users/pydanny/staging.py Symlink your settings folder! Cause you’ll remember to do this with each server setup... Tuesday, April 19, 2011
  • 6. Django Worst Practices Database Choices Tuesday, April 19, 2011
  • 7. Django Worst Practices Database Choices • Use a relational database to store ill- defined hierarchical data! Tuesday, April 19, 2011
  • 8. Django Worst Practices Database Choices • Use a relational database to store ill- defined hierarchical data! • Use NoSQL to store tabular data! Tuesday, April 19, 2011
  • 9. Django Worst Practices <%python scope="global"> # declare global variables, accessible # across this component's generated module message1 = "this is message one." message2 = "this is message two." message3 = "doh, im message three." </%python> <%python> # reference the global variables m.write("message one: " + message1) m.write("message two: " + message2) # we want to assign to message3, # so declare "global" first global message3 message3 = "this is message three." m.write("message three: " + message3) </%python> Tuesday, April 19, 2011
  • 10. Django Worst Practices <%python scope="global"> # declare global variables, accessible # across this component's generated module message1 = "this is message one." message2 = "this is message two." message3 = "doh, im message three." </%python> <%python> # reference the global variables m.write("message one: " + message1) m.write("message two: " + message2) # we want to assign to message3, # so declare "global" first global message3 message3 = "this is message three." m.write("message three: " + message3) </%python> Who needs caching? Tuesday, April 19, 2011
  • 11. Django Worst Practices <%python scope="global"> # declare global variables, accessible # across this component's generated module message1 = "this is message one." message2 = "this is message two." message3 = "doh, im message three." </%python> <%python> # reference the global variables m.write("message one: " + message1) m.write("message two: " + message2) # we want to assign to message3, # so declare "global" first global message3 message3 = "this is message three." m.write("message three: " + message3) </%python> Who needs caching? Performance awesomeness! Tuesday, April 19, 2011
  • 12. Django Worst Practices <%python scope="global"> # declare global variables, accessible # across this component's generated module message1 = "this is message one." message2 = "this is message two." message3 = "doh, im message three." </%python> <%python> # reference the global variables m.write("message one: " + message1) m.write("message two: " + message2) # we want to assign to message3, # so declare "global" first global message3 message3 = "this is message three." m.write("message three: " + message3) </%python> Who needs caching? Performance awesomeness! Replaces pesky django templates! Tuesday, April 19, 2011
  • 13. Django Worst Practices <%python scope="global"> # declare global variables, accessible # across this component's generated module message1 = "this is message one." message2 = "this is message two." message3 = "doh, im message three." </%python> <%python> # reference the global variables m.write("message one: " + message1) m.write("message two: " + message2) # we want to assign to message3, # so declare "global" first global message3 message3 = "this is message three." m.write("message three: " + message3) </%python> Who needs caching? Performance awesomeness! Replaces pesky django templates! Tuesday, April 19, 2011
  • 14. Django Worst Practices <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/persons"> <root> <xsl:apply-templates select="person"/> </root> </xsl:template> <xsl:template match="person"> <name username="{@username}"> <xsl:value-of select="name" /> </name> </xsl:template> </xsl:stylesheet> Use XSLT for awesome performance! Tuesday, April 19, 2011
  • 15. Django Worst Practices Put critical business logic in... Tuesday, April 19, 2011
  • 16. Django Worst Practices Put critical business logic in... • The templates Tuesday, April 19, 2011
  • 17. Django Worst Practices Put critical business logic in... • The templates • settings Tuesday, April 19, 2011
  • 18. Django Worst Practices Put critical business logic in... • The templates • settings • The context processors Tuesday, April 19, 2011
  • 19. Django Worst Practices Put critical business logic in... • The templates • settings • The context processors • Middleware! Tuesday, April 19, 2011
  • 20. Django Worst Practices Use metaclasses instead of abstract models! Tuesday, April 19, 2011
  • 21. Django Worst Practices In settings: from django.db import models blog2_fields = [ models.CharField(“title”, max_length=50), models.TextField(“note”) ] Tuesday, April 19, 2011
  • 22. Django Worst Practices Present using Different fonts Dark text Dire backgrounds Tuesday, April 19, 2011
  • 23. Django Worst Practices Don’t use http://djangopackages.com Invent everything yourself! Tuesday, April 19, 2011