Disclaimer: I received a review copy of this book from the publisher, Packt Publishing.
I am using Django almost at full time since 0.96 (it was 2007, March when it was tagged), so from about 3 years now, and I have read almost every book has been out from Apress.
This is the first book I read from Packt about Django (I have read one about Plone, one about Joomla and one about jQuery), and I may say that I am impressed from their way to package valuable and very specific contents in a single book.
If many times it is easy to get specified contents on the web, in this case, for the topics covered by this book, this is not so obvious and anyway it is very nice to have all the material packaged and structured in an excelent way just in a single book.
Intended audience of the book: for reading it you must have already a working experience on Django. If you want to learn Django, this is absolutely not the first book to go for, so keep it in mind!
But if you have some experience it will teach you the latest best pratices about test and debugging.
Basically, the book is divided in two parts: the first one is about testing, the second about debugging.
In the part about testing you will basically learn about Doc Tests and Unit Tests.
After describing the basic syntax for running tests in Django (the 'test' option of the django-admin utility), the book teach you how to write Doc Tests and what are their advantages. This kind of tests have the advantage to both test code and create documentation at the same time. There are also some disadvantages, as pointed out from the last part of the second chapter.
Chapter 3 shows you how to write effective unit tests, and how to create and use test data (fixtures) for running this tests.
The chapter 4 illustrates in great details the TestCase class, while chapter 5 shows you how to integrate Django with other test tools like Coverage (for determining how much of our code you are effectively testing) and Twill (a convenient way to navigate a web application from command line, if you are not satisfied with the test client API included in Django).
Chapter 6 introduces the second main argument of the book: debugging. After this general introduction and a maybe too much detailed chapter about the debug page and the various type of errors you may find developing web application with Django, in chapter 8 there are excellent indications about how to track SQL queries, how to use the Django Debug Toolbar (a must-have tool for any serious developer!) and the several ways to log from within the application.
Chapter 9 gives a detailed explanation of the pdb debugger (here, in my opinion, the autor should have at least mentioned the ipdb debugger, that basically is pdb for using within ipython for having tab completion and nice tracebacks).
Chapter 10 gives other options if you are in a situation where all the other tools are failing: for example it shows you how to use the Django Project web site for researching help, for accessing (and creating) tickets and understanding their history and if a fixed has been released (basically is a Trac guide): maybe quiete obvious information for dedicating a whole chapter at it.
Finally last chapter is about deploying a Django web site in production: after a basic tutorial for creating the WSGI script (actually the recommended way to deploy a Python web site), and an Apache virtual host, this chapter will show you how to debug Apache if problems arise and how to test multithreaded behavior.
Principal benefits from this book
---------------------------------
- Nice structure of the topics
- Every chapter is built on the previous one, through a very nice step by step tutorial (a survey application). Note that, as not in many books, the whole code is perfectly working even for latter Django releases
- Excellent collection of best practices for a developer: this book will make the difference!
Const
-----
- Too much details in some case (for example the bug section, as already other reviewers have indicated, and the many pages dedicated to the Django tracking system), and this is the reason because I give 4 stars and not 5
In any case, for people willing to make serious test-driven agile development with this beautiful web framework, this is a must-have book!