SlideShare a Scribd company logo
Two Scoops of Django
Michelle Leu | 2013/10/29
About the Authors
DjangoPackages.com
the OpenComparison framework. We ran the largest sprint
at PyCon 2011.

PyLadies
a women‟s outreach/mentorship group. Nurturing the group was
basically a 2nd fulltime job for us in 2011.
The first ever PyCon Philippines, a 300-person conference
about the Python programming language held in the Philippines.

LA Open Source Hackathon event series, which brings together
open-source developers from different programming backgrounds.

Audrey Roy
Daniel Greenfeld
Before You Start

Buy the e-book bundle for $17
Buy the print version for $29.95

If you are new to Django ……

Python programming language
Python 2.7.x

Buy the e-book bundle for $17
Django tutorial:
https://docs.djangoproject.com/en
/1.5/intro/tutorial01/.
Django 1.5
Core Concepts
•
•
•
•

Simplicity is the ultimate sophistication.
Fat Models, Helper Modules, Thin Views, Stupid Templates
Start With Django by Default
Stand on the Shoulders of Giants
Make Your Code Readable

•
•
•
•

Avoid abbreviating variable names.
Write out your function argument names.
Document your classes and methods.
Refactor repeated lines of code into reusable functions or
methods.
PEP8
•

Style Guide for Python Code
 “Use 4 spaces per indentation level.”
 “Separate top-level function and class definitions with two
blank lines.”

 “Method definitions inside a class are separated by a single
blank line.”
The Word on Imports

Marketing
Standard library

Training
Core Django

Assesment
Third-party apps

Technology
Your apps

Ex: math

Import from django

Plugins

Imports from the apps
that you created as
part of your Django
project.
The Word on Imports
Use Explicit Relative Imports
Avoid Using Import *

•
•

The reason for this is to avoid implicitly loading all of another
Python module‟s locals into and over our current module‟s
namespace, which can produce unpredictable and sometimes
catastrophic results.
Python Naming Collisions
Django Coding Style Guidelines

•

•

Use underscores (the „_‟ character) in URL pattern names
rather than dashes as this is friendlier to more IDEs and text
editors. Note that we are referring to the name argument of
url() here, not the actual URL typed into the browser. Dashes
in actual URLs are fine.

For the same reason, use underscores rather than dashes in
template block names.
Reference
• Two Scoops of Django:https://django.2scoops.org/
• PEP 8 coding conventions:
http://www.python.org/dev/peps/pep-0008/

•

Django Coding Style
Guidelines:https://docs.djangoproject.com/en/1.5/internals/con
tributing/writing-code/coding-style/

Conclusion
Projects with varying styles are much harder to maintain, slowing development and increasing the
chances of developer mistakes.
Thanks for your listening

Michelle Leu

flywindy2002@gmail.com
Twitter: @flywindy
Developer @ Brand Karma

More Related Content

What's hot (20)

PPT
Django, What is it, Why is it cool?
Tom Brander
 
PPTX
Introduction to django
Sreenath Ramamoorthi
 
PDF
Django course final-project
Udi Bauman
 
PDF
Python/Django Training
University of Technology
 
PDF
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
Casey Kinsey
 
PDF
Maven beyond hello_world
Gabriel Dogaru
 
PPTX
Lecture android best practices
eleksdev
 
PPTX
Django strategy-test
Royce Haynes
 
PPT
Apache ANT vs Apache Maven
Mudit Gupta
 
ODP
Unit Test Android Without Going Bald
David Carver
 
PPTX
Introduction to Django
Knoldus Inc.
 
PPT
Introduction to Apache Ant
Muhammad Hafiz Hasan
 
PDF
Nicholas Gustilo "Clean Android: building great mobile apps"
IT Event
 
PDF
Maven tutorial for beginners
inTwentyEight Minutes
 
PDF
Android Modularization
Young-Hyuk Yoo
 
PPTX
Apache Maven - eXo VN office presentation
Arnaud Héritier
 
PPTX
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Udit Gangwani
 
PPTX
Introduction to Maven
Mindfire Solutions
 
ODP
An Introduction to Maven Part 1
MD Sayem Ahmed
 
PPTX
Audit your reactive applications
OCTO Technology
 
Django, What is it, Why is it cool?
Tom Brander
 
Introduction to django
Sreenath Ramamoorthi
 
Django course final-project
Udi Bauman
 
Python/Django Training
University of Technology
 
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
Casey Kinsey
 
Maven beyond hello_world
Gabriel Dogaru
 
Lecture android best practices
eleksdev
 
Django strategy-test
Royce Haynes
 
Apache ANT vs Apache Maven
Mudit Gupta
 
Unit Test Android Without Going Bald
David Carver
 
Introduction to Django
Knoldus Inc.
 
Introduction to Apache Ant
Muhammad Hafiz Hasan
 
Nicholas Gustilo "Clean Android: building great mobile apps"
IT Event
 
Maven tutorial for beginners
inTwentyEight Minutes
 
Android Modularization
Young-Hyuk Yoo
 
Apache Maven - eXo VN office presentation
Arnaud Héritier
 
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Udit Gangwani
 
Introduction to Maven
Mindfire Solutions
 
An Introduction to Maven Part 1
MD Sayem Ahmed
 
Audit your reactive applications
OCTO Technology
 

Viewers also liked (20)

PDF
Django 實戰 - 自己的購物網站自己做
flywindy
 
PDF
那些年,我用 Django Admin 接的案子
flywindy
 
PDF
Django workshop homework 3
flywindy
 
PDF
Two scoops of Django - Deployment
flywindy
 
PDF
Working with the django admin
flywindy
 
PDF
Learning django step 1
永昇 陳
 
PDF
Two scoops of django 1.6 - Ch7, Ch8
flywindy
 
PDF
Command line 初級寶典
Tom Chen
 
PDF
Live Performance Effects
Tom Chen
 
PPS
Xmas
Tom Chen
 
PDF
真蝦意外接到的Case
Tom Chen
 
PDF
Pytables
gowell
 
PDF
Elasticsearch intro output
Tom Chen
 
PDF
AngularJS Sharing
Tom Chen
 
PDF
Django step0
永昇 陳
 
PPTX
Gitlab
Tom Chen
 
PDF
愛樂工程師
Tom Chen
 
PDF
Integrating tornado and webpack
Tom Chen
 
PDF
解密解密
Tom Chen
 
PDF
Django sharing
Tom Chen
 
Django 實戰 - 自己的購物網站自己做
flywindy
 
那些年,我用 Django Admin 接的案子
flywindy
 
Django workshop homework 3
flywindy
 
Two scoops of Django - Deployment
flywindy
 
Working with the django admin
flywindy
 
Learning django step 1
永昇 陳
 
Two scoops of django 1.6 - Ch7, Ch8
flywindy
 
Command line 初級寶典
Tom Chen
 
Live Performance Effects
Tom Chen
 
Xmas
Tom Chen
 
真蝦意外接到的Case
Tom Chen
 
Pytables
gowell
 
Elasticsearch intro output
Tom Chen
 
AngularJS Sharing
Tom Chen
 
Django step0
永昇 陳
 
Gitlab
Tom Chen
 
愛樂工程師
Tom Chen
 
Integrating tornado and webpack
Tom Chen
 
解密解密
Tom Chen
 
Django sharing
Tom Chen
 
Ad

Similar to Two scoops of django Introduction (20)

PPTX
Introduction to django (and py)
Adrian Andreias
 
PDF
Python Style Guide
Jiayun Zhou
 
PDF
Learn Django Tips, Tricks & Techniques for Developers
Mars Devs
 
PPTX
Tango with django
Jaysinh Shukla
 
PDF
Introduction to Python and Django
solutionstreet
 
PPTX
Two scoops of django version one
viv123
 
PDF
Django
Ksd Che
 
PDF
Os Goodger
oscon2007
 
ODP
Introduce Python
M Asep Indrayana
 
ODP
dJango
Bob Chao
 
PPTX
Introduction to django
Vlad Voskoboynik
 
PPTX
Django - Python MVC Framework
Bala Kumar
 
PDF
django
webuploader
 
PDF
Learn To Code Like A Professional With Pythonan Open Source Versatile And Pow...
metalsmunshe
 
PDF
Python Django tutorial | Getting Started With Django | Web Development With D...
Edureka!
 
PPTX
Intro to Python for C# Developers
Sarah Dutkiewicz
 
PDF
Django For Beginners Converted William S Vincent
sarkingiio
 
DOCX
Akash rajguru project report sem v
Akash Rajguru
 
PDF
Python Ecosystem for Beginners - PyCon Uruguay 2013
Hannes Hapke
 
PDF
Reusable Apps
DjangoCon2008
 
Introduction to django (and py)
Adrian Andreias
 
Python Style Guide
Jiayun Zhou
 
Learn Django Tips, Tricks & Techniques for Developers
Mars Devs
 
Tango with django
Jaysinh Shukla
 
Introduction to Python and Django
solutionstreet
 
Two scoops of django version one
viv123
 
Django
Ksd Che
 
Os Goodger
oscon2007
 
Introduce Python
M Asep Indrayana
 
dJango
Bob Chao
 
Introduction to django
Vlad Voskoboynik
 
Django - Python MVC Framework
Bala Kumar
 
django
webuploader
 
Learn To Code Like A Professional With Pythonan Open Source Versatile And Pow...
metalsmunshe
 
Python Django tutorial | Getting Started With Django | Web Development With D...
Edureka!
 
Intro to Python for C# Developers
Sarah Dutkiewicz
 
Django For Beginners Converted William S Vincent
sarkingiio
 
Akash rajguru project report sem v
Akash Rajguru
 
Python Ecosystem for Beginners - PyCon Uruguay 2013
Hannes Hapke
 
Reusable Apps
DjangoCon2008
 
Ad

Recently uploaded (20)

PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Python basic programing language for automation
DanialHabibi2
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 

Two scoops of django Introduction

  • 1. Two Scoops of Django Michelle Leu | 2013/10/29
  • 2. About the Authors DjangoPackages.com the OpenComparison framework. We ran the largest sprint at PyCon 2011. PyLadies a women‟s outreach/mentorship group. Nurturing the group was basically a 2nd fulltime job for us in 2011. The first ever PyCon Philippines, a 300-person conference about the Python programming language held in the Philippines. LA Open Source Hackathon event series, which brings together open-source developers from different programming backgrounds. Audrey Roy Daniel Greenfeld
  • 3. Before You Start Buy the e-book bundle for $17 Buy the print version for $29.95 If you are new to Django …… Python programming language Python 2.7.x Buy the e-book bundle for $17 Django tutorial: https://docs.djangoproject.com/en /1.5/intro/tutorial01/. Django 1.5
  • 4. Core Concepts • • • • Simplicity is the ultimate sophistication. Fat Models, Helper Modules, Thin Views, Stupid Templates Start With Django by Default Stand on the Shoulders of Giants
  • 5. Make Your Code Readable • • • • Avoid abbreviating variable names. Write out your function argument names. Document your classes and methods. Refactor repeated lines of code into reusable functions or methods.
  • 6. PEP8 • Style Guide for Python Code  “Use 4 spaces per indentation level.”  “Separate top-level function and class definitions with two blank lines.”  “Method definitions inside a class are separated by a single blank line.”
  • 7. The Word on Imports Marketing Standard library Training Core Django Assesment Third-party apps Technology Your apps Ex: math Import from django Plugins Imports from the apps that you created as part of your Django project.
  • 8. The Word on Imports
  • 10. Avoid Using Import * • • The reason for this is to avoid implicitly loading all of another Python module‟s locals into and over our current module‟s namespace, which can produce unpredictable and sometimes catastrophic results. Python Naming Collisions
  • 11. Django Coding Style Guidelines • • Use underscores (the „_‟ character) in URL pattern names rather than dashes as this is friendlier to more IDEs and text editors. Note that we are referring to the name argument of url() here, not the actual URL typed into the browser. Dashes in actual URLs are fine. For the same reason, use underscores rather than dashes in template block names.
  • 12. Reference • Two Scoops of Django:https://django.2scoops.org/ • PEP 8 coding conventions: http://www.python.org/dev/peps/pep-0008/ • Django Coding Style Guidelines:https://docs.djangoproject.com/en/1.5/internals/con tributing/writing-code/coding-style/ Conclusion Projects with varying styles are much harder to maintain, slowing development and increasing the chances of developer mistakes.
  • 13. Thanks for your listening Michelle Leu [email protected] Twitter: @flywindy Developer @ Brand Karma