Update! The third edition, Two Scoops of Best Practices For Django 1.8 is available! Revised and expanded to 532 pages, it's a whole new book full of new material. Please consider it before purchasing this edition! Two Scoops of Best Practices For Django 1.6 is chock-full of even more 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. We have put thousands of hours into the second edition of the book, writing and revising its material to include over 130 new pages of concise, example-packed text containing 5 new chapters and 3 new appendices. Table of Contents What is everyone saying about Two Scoops of Django?
* Learned how to fight with swords * Ridden horses * Cycled thousands of miles on multiple continents * Performed cartwheels in capoeira circles on multiple continents * Worked as an engineer at NASA * Married a woman he dreamed about before he ever met her
He believes this combination of skills and experiences makes him the ideal fantasy and tech author.
The best book for experienced Django developers to up their skills and code quality.
This book covers the best-practices from setting up the development environment, asynchronous processing, to the deployment.
Readers note that this is not a tutorial book. To get the most out of it, you must have 1-year experience of working with Django. Or, if you know your way around, say, models, you can jump into the corresponding chapter and make your code cleaner
I am honestly torn about this book. I want to give it a good review, because I learned a few useful things from it and because of that the book proved to be a good investment. I am certainly a better Django developer having read it. But at the same time it contains chapters like the one about logging, which can be summed up as saying "Hey, logging is good. You should log more. Go, read the official Django docs if you want to know how." Not very helpful. Fortunately other parts of the book are a little more eloquent, but I still couldn't shake the feeling that it was all written during a few coffee breaks.
Maybe I am too harsh. As I noted, I was able to learn from it and what I did learn is useful in my day to day work and for that alone I am glad I did decide to make the purchase. On the other hand this book has plenty of untapped potential that could turn it into THE book on Django best practices should the authors decide not to just skim the surface.
The authors updated the book this morning and I decided to reward their favor with a review.
This book is excellent. Good best practice guidelines for Django delivered with ice cream and examples from personal experience. I'm very happy this is released, it even better than the previous editions. The book is easy reading, but dense information. I love the cover and the interior drawings. If i had a complaint it would be I want more drawings!
It has been an informative and entertaining read for me.
The interesting thing is, although this is a book about Django, the range of topics covered are wide, beyond that of Django-specific practices. Beside Django, the authors also touched various other topics on web development life cycle. Some examples include setting up your environment, testing, documentation, deployment, and even where to look for helps.
Needless to say, a 500 pages book cannot cover this amount of material in sufficient depth. Instead, the authors have decided to focus on the Django-specific chapters and only give us a glimpse of the other topics. These chapters are very basic and additional details can found from the linked references.
On the other hand, the topics regarding Django-specific features and best practices are covered in sufficient depth. The authors stroke a good balance between giving too much and too little details. The chapters are short, easy to read, and very informative.
Sometime, however, the authors assumes that a certain best practices is self-explanatory and does not need much justification. I had this problem with their advocacy on using mixins and preference for Class Based Views. However, this is not a serious problem.
Overall, I considered this to be a job well done. The authors succeeded in presenting the best practices of the Django web framework in an entertaining format. I would recommend for anyone who has learnt the basic and is ready to dive deeper into the Django web framework.
Great book - I was initially scared it'd be to difficult for me because I'm a beginner but the book helped me by not only getting a better understanding of Django but also showing many tips and useful packages I'll definitely use on my Django journey! Can't wait for the paperback!
IMHO, "Two Scoops of Django" is the best piece of Django documentation out there. It covers lots of things that are not covered by the existing documentation. Both the authors are very experienced Python/Django developers and they give tons of precious tips. I think this is the perfect book for everyone who knows the basics of Django and want to know how to use it more effectively. I've learned a lot from it and I'm already applying many tips to my projects.
Thanks and congratulations to the authors of this awesome book!
Great book for developing sites with Django. It goes beyond the default django tutorial and offers some examples on how to do things (i.e. defining custom model forms) with best practices.
Very good source of django framework knowledge specially for mid or senior developers. Covers from django specificities to good practices on deployment of django projects.
I read the version for Django 3.x. Wowzah - worth its weight in gold and well worth a re-read. While Daniel and Audrey give countless tips for specific tools and practices, I benefitted most from the high-level concepts and best practices that come from their years of experience. As a novice in the tech world, having read this book, I feel much more confident and excited to continue growing (as well as intimidated by how much there is to learn, especially with security).
Things I don't want to forget: - Recommended Django project structure (core app; multiple settings files that inherit from base from dev, staging, prod; keep templates in template directory and list apps as subdirectories; using shallow JSON (non version-controlled, gitignore) instead of environment variables for keys and passwords) - PEP styling (like import order of (1) stdlib imports, (2) core django imports, (3) third party imports, (4) internal app imports) - The benefit and necessity of database transactions where two or more db updates are wrapped in a single unit of work (and can be easily rolled back in case of one failure to avoid db corruption) - Avoid raw SQL in app since it is db-specific - Bias toward class-based views over function-based views (Keep business logic out of views!!) - A Django view is just a callable that accepts a request object and returns an HTTP response - The most important thing to remember about forms is that they should be used to validate incoming data (although forms are also commonly used for simply GET searches that don't manipulate the db) - Always us CSRF (Cross-Site Request Forgery) when modifying data (i.e. using POST) - HTML's {{ block.super }} allowing templates to inherit from base without overriding base content (like when base has style sheet that is needed downstream, but downstream templates have other specific stylesheets) - REST APIs are really just another type of view (HTTP request to return HTTP response) - Mask latency with animations! - Django Admin is one of the main reasons to use Django over other web frameworks - Since Django only allows one User table, the author's recommendation/preference is to link back from a related model and combine with proxy models (since these don't add fields). This way users can be assigned to multiple roles where role-specific fields can be managed in downstream, linked tables. - Fun little library for testing Django projects: "coverage" (gamify your testing exposure by trying to keep the testing percentage higher for each new commit) - Set up a CI (Continuous Integration) server to run your test suite with every new commit/push - Excellent introduction to security: you must have HTTPS for your entire site (locks communication between site and end user, ensuring that web content is not being manipulated through the middle man injection) - Don't store unnecessary data unless legally required to do so (including payment/CC information or PII/PHI) - In Appendix C, there are even more additional resources!!😄
I was looking for a good book to learn Django and this one was at the top of the lists. So, let's start with a quote.
This book is not a tutorial. If you are new to Django, this book will be helpful but large parts will be challenging for you. (p. xxxi)
I've been doing web apps for many years, and I've dabbled in Python a while back. Surely I'll be smart enough to fill in the gaps, provided the examples have enough context.
The early chapters about setting up a project and organizing settings went fine. The authors zeroed in on one approach, gave a trivial example, and discussed the forces at play. It's opinionated, but I can relate. But by the time we get to models and database queries and views, the trivial examples are gone and there is nothing to establish a context for the conversation. There are deep links to the official documentation, but I basically have to put the book down to go read a ton of materials on the web before I can continue on.
So I stopped reading after ~20%. I'll come back to it when I know Django better.
Django is now at version 2.0.6 but the book is about version 1.11. A quick search for the differences listed some rather advanced concepts, so I think it should still hold up for casual users.
Never thought that a programming book would be so engaging and so fun to read. Or after having read a couple I thought that the enthusiasm would wane off. Rare combination: Fun to read, interesting content, some of it can be flair based on your knowledge on the subject, some of it gold. I run through it a couple of times to get a grasp of the subjects, while changing my code-base in small increments following the advice. Will be circling around it for the next months.
Trying to limit my enthusiasm: (1) Good articulated content, (2) page turner(!), (3) many references on where to go for here if I want to do more (4) written from the people that maintain cookiecutter so purchasing it kind of makes me feel that I am helping them financially for all the time they saved me.
You only need to be a bit cautious if you do not know Python beforehand as it is a Django book not a Python one. Cannot wait (it is Saturday) for Monday to touch my code-base to implement more recommendations.
Update: coming back again and again after couple of months: +1 star :)
Over the past four years, I've worked with Django in a variety of contexts, from consulting to startups to research. It's my web framework of choice and I felt pretty effective & competent using it.
The highest praise that I can offer this book is that it made me feel like a complete amateur. Greenfield and Roy put together a concise and actionable collection of tips and tricks to help us all become better Djangonauts. The writing was clear and straightforward, with plenty of excellent code examples.
Some books entertain, others inform. This one will be one that makes me a much more effective developer and for that, I thank the authors.
(Now it's time to start refactoring some projects...)
A brief book explaining various stuff on Django. IMHO, the book should be read directly after one learns "What is what?" in Djanga: --> finishing the Django tutorial, doing a sample app that consists of various models, views, templates, forms, using signals, implementing logging etc. etc. After that, one can be enlightened as there are various nicer ways of doing this and that.
For me, most of the stuff I read in the book has been the practices that I apply in my professional life, so It has been some kind of approval from Django professionals. And It has contributed me much in some corner-case examples.
Btw, This is the first book I've read in my Kindle Paperwhite 2, so its place is somewhere special for me (=
This book is, as the title indicates, not a tutorial or a how-to, but a best practices guide. Aimed for the Django expert, it will still provide useful tips to all but the very greenest of beginners. It refers to a great deal of other material, and covers every basic aspect of an ordinary application, from the core structural materials of models, views, and the like to vital supporting practices such as testing, documentation, and security.
It is a book with good humor and a friendly spirit. The one thing I didn't care for was how much whitespace it has, at times feeling quite wasteful. Overall, it won't change your life, but it does deliver what it promises, two scoops of well-considered best practices.
If you have a year or so of experience with Django framework and look forward to expand your horizons - this book is a must read.
Two Scoops of Django touches on broad spectrum of topics, not only Django internals like views, models, ORM, etc.. But also deployment, security, debugging, testing, monitoring, and much more.
Written with multiple real life (ice-cream based) examples it never goes too much into theoretical concepts, keeps everything relevant and relatable, which motivates to read on.
If you're like me, not only will you get insight into industry-standard solutions to problems you patched "somehow" sometime in the past, but also a sneak peak to problems that are coming in near future, only now you'll have the tools and knowledge to tackle them properly!
Well written book but perhaps best for intermediate Djangonauts. To the authors' credit they do mention their intended audience at the beginning.
As a beginner good deal of this was above my head and many basic concepts are not explained. It did give me a detailed but fuzzy introduction to Django development. I'd give them five stars if they created simple intro to Django section as this information is desperately needed because the Django tutorial also doesn't do the best job at this.
Ultimately, this book does what it says it will, it is well organized and I have a feeling I'll be referring to this book often in the future.