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

PDF
Django: Beyond Basics
PDF
Django best practices for logging and signals
PDF
Introduction to django framework
PDF
Django Best Practices
PDF
Getting Started With Django
PPTX
Django Interview Questions and Answers
PDF
Automation - fabric, django and more
PPTX
Django Seminar
Django: Beyond Basics
Django best practices for logging and signals
Introduction to django framework
Django Best Practices
Getting Started With Django
Django Interview Questions and Answers
Automation - fabric, django and more
Django Seminar

What's hot (20)

PPT
Django, What is it, Why is it cool?
PPTX
Introduction to django
PDF
Django course final-project
PDF
Python/Django Training
PDF
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
PDF
Maven beyond hello_world
PPTX
Lecture android best practices
PPTX
Django strategy-test
PPT
Apache ANT vs Apache Maven
ODP
Unit Test Android Without Going Bald
PPTX
Introduction to Django
PPT
Introduction to Apache Ant
PDF
Nicholas Gustilo "Clean Android: building great mobile apps"
PDF
Maven tutorial for beginners
PDF
Android Modularization
PPTX
Apache Maven - eXo VN office presentation
PPTX
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
PPTX
Introduction to Maven
ODP
An Introduction to Maven Part 1
PPTX
Audit your reactive applications
Django, What is it, Why is it cool?
Introduction to django
Django course final-project
Python/Django Training
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
Maven beyond hello_world
Lecture android best practices
Django strategy-test
Apache ANT vs Apache Maven
Unit Test Android Without Going Bald
Introduction to Django
Introduction to Apache Ant
Nicholas Gustilo "Clean Android: building great mobile apps"
Maven tutorial for beginners
Android Modularization
Apache Maven - eXo VN office presentation
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Introduction to Maven
An Introduction to Maven Part 1
Audit your reactive applications
Ad

Viewers also liked (20)

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

Similar to Two scoops of django Introduction (20)

PPTX
Introduction to django (and py)
PDF
Python Style Guide
PDF
Learn Django Tips, Tricks & Techniques for Developers
PPTX
Tango with django
PDF
Introduction to Python and Django
PPTX
Two scoops of django version one
PDF
Django
PDF
Os Goodger
ODP
Introduce Python
ODP
dJango
PPTX
Introduction to django
PPTX
Django - Python MVC Framework
PDF
django
PDF
Learn To Code Like A Professional With Pythonan Open Source Versatile And Pow...
PDF
Python Django tutorial | Getting Started With Django | Web Development With D...
PPTX
Intro to Python for C# Developers
PDF
Django For Beginners Converted William S Vincent
DOCX
Akash rajguru project report sem v
PDF
Python Ecosystem for Beginners - PyCon Uruguay 2013
PDF
Reusable Apps
Introduction to django (and py)
Python Style Guide
Learn Django Tips, Tricks & Techniques for Developers
Tango with django
Introduction to Python and Django
Two scoops of django version one
Django
Os Goodger
Introduce Python
dJango
Introduction to django
Django - Python MVC Framework
django
Learn To Code Like A Professional With Pythonan Open Source Versatile And Pow...
Python Django tutorial | Getting Started With Django | Web Development With D...
Intro to Python for C# Developers
Django For Beginners Converted William S Vincent
Akash rajguru project report sem v
Python Ecosystem for Beginners - PyCon Uruguay 2013
Reusable Apps

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
MYSQL Presentation for SQL database connectivity
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
KodekX | Application Modernization Development
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
MYSQL Presentation for SQL database connectivity
“AI and Expert System Decision Support & Business Intelligence Systems”
MIND Revenue Release Quarter 2 2025 Press Release
Encapsulation_ Review paper, used for researhc scholars
Mobile App Security Testing_ A Comprehensive Guide.pdf
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Per capita expenditure prediction using model stacking based on satellite ima...
KodekX | Application Modernization Development
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Network Security Unit 5.pdf for BCA BBA.
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Spectroscopy.pptx food analysis technology
sap open course for s4hana steps from ECC to s4
20250228 LYD VKU AI Blended-Learning.pptx

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 flywindy2002@gmail.com Twitter: @flywindy Developer @ Brand Karma