Review: Django Essentials
A month ago Dyson D’Souza from PacktPub approached me asking if I would be interested in reviewing Django Essentials. I am using Django for some time now – somewhen pre 0.96, I remember the 0.96 release for some reason, I think it was the length of the release cycle but I am not sure anymore – and I really wanted to see how the introduction resources changed, so this was a good chance.
Samuel Dauzon does a really good job writing for people who are just starting to work with Django. Beside some history he manages to explain all important concepts and, this is something I especially like, transports them to the terminology used by Django. After explaining what MVC is he also explains what Django is calling the different parts and how they fit together. This is something I often missed when reading a blog post or skimming through another book.
While it is a good introduction you should already now a little bit of Python to feel comfortable. The book is suggesting Python 3 which is in my opinion still a risky route to take for a beginner. While most libraries are ported you can still easily run into something that will just not work. Knowing some Python and HTML is especially important since there are several errors in the code examples, like missing bracers or typos, so you should be able to see and correct those.
Some best practices are explained, which is nice. It teaches you how to use South for example and discusses the pros and cons of class based views (CBV) and function based views (FBV). While South is something I consider a must have CBVs are still a topic that is hotly discussed and where lovers and haters will likely never agree. Showing the advantages and problems in an objective way is the best way to help someone understand the situation – it will not replace the experience getting burned by CBVs or at some point noticing that a CBV would have made a lot more sense than a FBV, but no explanation, no matter how good, can do this.
Samuel is teaching some things in this book that make a lot of sense when working on bigger projects, like separating the views in multiple files instead of throwing everything in a
On the other hand there are also parts that are just bad. Creating a simple user model and storing passwords plain text before moving to
django.contrib.auth is just wrong and the fact that it was shown will likely, at some point, cause someone who read it to do it and ship it to production. While it is great to show how much Django can help you with basic tasks there are things that should in my opinion never be taught or shown the wrong way. Authentication and authorization are on the top of the list.
The deployment section is a nice introduction to the most important concepts, but I consider Michael Hartls approach for Learn Rails by Example as superior. Just use Heroku. It is free. It provides everything you need and it gets out of your way so you can see results immediately. Just throwing some components on a virtual server can work, too, but it takes more time and brings you no advantage when trying to get your application into production.
Especially useful is the cheat sheet at the end of the book giving a quick overview over the different field types, common options, filters, and everything else you need to build your first application. Overall the book is making a good impression as learning material and getting a rough idea what Django is capable of and what can be done with it.