Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Django Worst Practices

17 677 vues

Publié le

Just to be clear, all of these things suck. Please DO NOT use these techniques! It was a joke, and if you attempt any of these things you are making a big mistake.

Publié dans : Technologie
  • If you are looking for trusted essay writing service I highly recommend ⇒⇒⇒WRITE-MY-PAPER.net ⇐⇐⇐ The service I received was great. I got an A on my final paper which really helped my grade. Knowing that I can count on them in the future has really helped relieve the stress, anxiety and workload. I recommend everyone to give them a try. You'll be glad you did.
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • I pasted a website that might be helpful to you: ⇒ HelpWriting.net ⇐ Good luck!
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Follow the link, new dating source: ❶❶❶ http://bit.ly/2ZDZFYj ❶❶❶
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Sex in your area is here: ♥♥♥ http://bit.ly/2ZDZFYj ♥♥♥
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Get Paid To Write Articles? YES! View 1000s of companies hiring online writers now! ◆◆◆ http://t.cn/AieXS5j0
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

Django Worst Practices

  1. 1. Django Worst Practices Daniel GreenfeldTuesday, April 19, 2011
  2. 2. Django Worst Practices Whole project in one appTuesday, April 19, 2011
  3. 3. Django Worst Practices Whole project in one app All your stuff in one place!Tuesday, April 19, 2011
  4. 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. 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. 6. Django Worst Practices Database ChoicesTuesday, April 19, 2011
  7. 7. Django Worst Practices Database Choices • Use a relational database to store ill- defined hierarchical data!Tuesday, April 19, 2011
  8. 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. 9. Django Worst Practices <%python scope="global"> # declare global variables, accessible # across this components 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. 10. Django Worst Practices <%python scope="global"> # declare global variables, accessible # across this components 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. 11. Django Worst Practices <%python scope="global"> # declare global variables, accessible # across this components 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. 12. Django Worst Practices <%python scope="global"> # declare global variables, accessible # across this components 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. 13. Django Worst Practices <%python scope="global"> # declare global variables, accessible # across this components 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. 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. 15. Django Worst Practices Put critical business logic in...Tuesday, April 19, 2011
  16. 16. Django Worst Practices Put critical business logic in... • The templatesTuesday, April 19, 2011
  17. 17. Django Worst Practices Put critical business logic in... • The templates • settingsTuesday, April 19, 2011
  18. 18. Django Worst Practices Put critical business logic in... • The templates • settings • The context processorsTuesday, April 19, 2011
  19. 19. Django Worst Practices Put critical business logic in... • The templates • settings • The context processors • Middleware!Tuesday, April 19, 2011
  20. 20. Django Worst Practices Use metaclasses instead of abstract models!Tuesday, April 19, 2011
  21. 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. 22. Django Worst Practices Present using Different fonts Dark text Dire backgroundsTuesday, April 19, 2011
  23. 23. Django Worst Practices Don’t use http://djangopackages.com Invent everything yourself!Tuesday, April 19, 2011

×