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 wo...
Before You Start

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

If you are new to Django ……

Python prog...
Core Concepts
•
•
•
•

Simplicity is the ultimate sophistication.
Fat Models, Helper Modules, Thin Views, Stupid Templates...
Make Your Code Readable

•
•
•
•

Avoid abbreviating variable names.
Write out your function argument names.
Document your...
PEP8
•

Style Guide for Python Code
 “Use 4 spaces per indentation level.”
 “Separate top-level function and class defin...
The Word on Imports

Marketing
Standard library

Training
Core Django

Assesment
Third-party apps

Technology
Your apps

E...
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 a...
Django Coding Style Guidelines

•

•

Use underscores (the „_‟ character) in URL pattern names
rather than dashes as this ...
Reference
• Two Scoops of Django:https://django.2scoops.org/
• PEP 8 coding conventions:
http://www.python.org/dev/peps/pe...
Thanks for your listening

Michelle Leu

flywindy2002@gmail.com
Twitter: @flywindy
Developer @ Brand Karma
Upcoming SlideShare
Loading in...5
×

Two scoops of django Introduction

626

Published on

Two scoops of django Introduction and Ch1

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
626
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Two scoops of django Introduction

  1. 1. Two Scoops of Django Michelle Leu | 2013/10/29
  2. 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. 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. 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. 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. 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. 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. 8. The Word on Imports
  9. 9. Use Explicit Relative Imports
  10. 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. 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. 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. 13. Thanks for your listening Michelle Leu flywindy2002@gmail.com Twitter: @flywindy Developer @ Brand Karma
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×