Two Scoops of Django banner

Best Practices For Django 1.5

This book is chock-full of material that will help you with your Django projects.

We’ll introduce you to various tips, tricks, patterns, code snippets, and techniques that we’ve picked up over the years.

This book is great for:

  • Beginning Django developers.
  • Developers with intermediate to advanced knowledge of Django who want to improve their Django projects.

This is the final release of the book. We have put thousands of hours into writing and revising almost 300 pages of concise, example-packed text.

Buy the e-book bundle for $17

Your purchase includes the book in PDF, Kindle (.mobi), and ePub formats.

Buy the print version for $29.95

We are offering the print copy of the book through Amazon.

Daniel Greenfeld and Audrey Roy

Two Scoops of Django book cover

Scroll Down for What People Say and More!


What have people said about Two Scoops of Django?

Peek inside the book

Reviews of Two Scoops of Django

Chapter 9, Common Patterns for Forms (PDF) is a good representation of the writing style, code samples, and typography effort of the book. We've done everything possible to make this book as accessible to the reader

This book covers the following and more:

The Optimal Django Setup

IMG

Tips and tricks for setting up your computer with Django and important tools the most optimal way.

Django Class-Based Views

IMG

We were part of the massive rewrite of Django’s official class-based view documentation. In the book we cover the gray area where the docs end and specific use cases begin.

Securing Your Django Projects

IMG

Django has a good security record. Help keep it that way by learning how to lock down and secure your projects.

Bottleneck Analysis

IMG

Is your project running slow? We cover how to determine where bottlenecks exist and how to fix them.

Advanced Django Form Usage

IMG

Daniel gave the DjangoCon 2011 Advanced Django Form Usage talk. Gain a deeper understanding of forms through his detailed examples.

Settings and Requirements Files

IMG

Manage your settings/dependencies for different environments such that 100% of settings and 0% of secret keys are in version control.

Model Inheritance

IMG

We provide everything you need to know about concrete, abstract, and proxy models.

The Django 1.5 User Model

IMG

Extend abstract base User classes to store the data you need.

Tons of Code Examples!

IMG

This book is loaded with code examples. We’ve gone the extra mile to put together great examples for you.

Want to know more? Scroll down!

See the table of contents!


Table of Contents

Here is a snapshot of the table of contents from Two Scoops of Django: Best Practices for Django 1.5.

  • Chapter 1: Coding Conventions
  • Chapter 2: The Optimal Django Environment Setup
  • Chapter 3: How to Lay Out Django Projects
  • Chapter 4: Fundamentals of Django App Design
  • Chapter 5: Settings and Requirements Files
  • Chapter 6: Database/Model Best Practices
  • Chapter 7: Function- and Class-Based Views
  • Chapter 8: Best Practices for Class-Based Views
  • Chapter 9: Common Patterns for Forms
  • Chapter 10: More Things to Know About Forms
  • Chapter 11: Building REST APIs in Django
  • Chapter 12: Templates: Best Practices
  • Chapter 13: Template Tags and Filters
  • Chapter 14: Tradeoffs of Replacing Core Components
  • Chapter 15: Working With the Django Admin
  • Chapter 16: Dealing with the User Model
  • Chapter 17: Django’s Secret Sauce: Third-Party Packages
  • Chapter 18: Testing Chapter of Doom!
  • Chapter 19: Documentation: Be Obsessed
  • Chapter 20: Finding and Reducing Bottlenecks
  • Chapter 21: Security Best Practices
  • Chapter 22: Logging: What’s It For, Anyway?
  • Chapter 23: Signals: Use Cases and Avoidance Techniques
  • Chapter 24: What About Those Random Utilities?
  • Chapter 25: Deploying Django Projects
  • Chapter 26: How To Release Your Own Django Packages
  • Chapter 27: Closing Thoughts
  • Appendix A: Packages Mentioned in This Book
  • Appendix B: Troubleshooting
  • Appendix C: Additional Resources
  • Acknowledgments
  • Index

Why We Wrote This Book

After seeing other fellow developers struggle to get past the same sorts of basic hurdles in Django we had to overcome, we realized that much of the Django knowledge that we take for granted is not written down with examples anywhere.

We decided to take everything we know and write it down. Along the way, we learned even more from others and wrote those things down as well.

Find Any Errors?

Although we’ve put in our best effort to catch all possible errors, there’s always the possibility of typos, confusing sections, or even practices that you disagree with.

If you find anything that appears to be incorrect, don’t hesitate to let us know at 2scoops@cartwheelweb.com. We’ll mention you in the book’s credits and do our best to put out an updated version quickly if needed.

Got Questions?

Read the FAQ!

Can’t Afford the Book?

If you’re struggling with finances and can’t afford it, let us know and we’d be happy to send you a free copy of the PDF edition. Drop us a note at 2scoops@cartwheelweb.com and we’ll get it to you within 72 hours.

About Us

Photo of Daniel Greenfeld and Audrey Roy

Hi. We’re Daniel Greenfeld and Audrey Roy. We come from strong technical backgrounds: NASA, O’Reilly (Daniel) and MIT, Microsoft, SugarSync (Audrey).

We’re best known for our open-source community leadership work on the following initiatives:

  • DjangoPackages.com and 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.
  • The LA Open Source Hackathon event series, which brings together open-source developers from different programming backgrounds.

We do Python and Django development and run a small Python/Django consulting shop called Cartwheel Web.


Mailing List

Keep up with the latest developments about Two Scoops of Django, including:

  • Updates to the book.
  • Resources that we think you will appreciate.
  • Developer events where you can find us.
  • Details about our wedding plans.
  • Office hours for your Python/Django questions.