I have known Danny Greenfeld (pydanny) for a few years now, I have read his blog, watched some of his talks, and even was lucky enough to work on a project with him. When I heard that he and his fiancée Audrey Roy were writing a book on Django best practices, I read it the first chance I could.
The book is called Two Scoops of Django, and it is currently available as an early access alpha version in ebook form. If you buy it now it will only cost you $12.00, and you will also get the final version of the book when it comes out. To find out more, or to buy the book head over to their website, http://django.2scoops.org.
The book is based on the soon to be released Django 1.5, and it covers everything from installation to deployment. If you are new to Django and want to learn it, this wouldn’t be the book that you read first, they are expecting that you have at least some Django knowledge going in. The book is targeting folks who already know Django, and want to write better Django code. It’s written in reference form, where each chapter stands on it’s own. If you have a question about the best way to do a certain type of model go to the models chapter, a question about templates, go to the templates chapter, etc. I personally like books like this, because it allows you to pick it up, find your answer and get back to work quickly.
Even though the book isn’t for beginners it doesn’t mean they shouldn’t read it. Once you have a good understanding of what Django is, and you are starting to write your application, it would be good to go over the different sections of the book to see what the best practices are for that section of code you are working on.
I don’t know about you, but I learn best by example, and that is what this book does, it gives you lots of examples for all the common situations you come across when writing a Django application. This allows you to learn, from the beginning, the best approaches to writing a Django application, and lets you skip all of the mistakes your normally make along the way. I wish they had this book when I started using Django.
In the book they go into the different ways to deploy your Django application. They mention dotCloud as a possible deployment solution, which is pretty cool. But, they don’t give you too much information on how to deploy your application to dotCloud. I can understand why, this is a book, and because deployment processes change often, they didn’t want to date their book, and have the information be wrong. So, if you read the book and want to know more about how to deploy your Django project to dotCloud, I would recommend reading our deploying your Django project to dotCloud tutorial , which will guide you through the process of getting your Django project up and running on dotCloud. The tutorial is currently based on Django 1.3 and 1.4, but we will update it to include Django 1.5, once it is officially released.
I have been programming in Django for over 5 years now, so I wasn’t sure how much new stuff I was going to be able to pick up, but I was surprised that I was able to pick up a few new tips and techniques. One chapter I really liked was the chapter on Class Based Views (CBVs). I have never been a fan of CBVs since they came out, and I think that was because the documentation wasn’t really good, and I didn’t see how they were better then the functional views. After reading the chapter, and reading the resources they recommend. I have a much better understanding of what CBVs are, and when, and when not, to use them. For me, that chapter alone is worth the cost of the book.
If you are currently working with Django, or you plan on working with Django sometime in the future, I recommend this book, you won’t be disappointed.