Book Review: Django for Beginners
Introduction:
Django For Beginners is a book by William Vincent, that teaches the Django framework, a popular web development framework in Python language. The book has project-based guidance, where the concepts are taught through projects.
Unfortunately, I have found two publication dates for this book. One is 2018, and another one is 2020. Perhaps one of them is a second edition? But that is not stated clearly in the book or in places like Amazon.
You can find the site of the author here, and his podcast here.
My review:
The book starts with instructions to install Django. Good practices of how to start a Django project are covered, and one thing that I came across for the first time was to work with environments.
Let's see whether I remember it correctly or not. A virtual environment allows developers to isolate their projects and work with their dependencies without affecting or disrupting their main system.
The book uses the Venv module, though I believe other third-party libraries are also used for this purpose. This is an important aspect of working with Python because it appears to be a common practice to create a virtual environment, and then work within that environment. I'm very glad that William covered this aspect in his book, in the very first chapter no less!
The second chapter onward is all about starting a project, setting up the dependencies, and explaining of function-based view, and the class-based view. While the first example in the book uses a function-based view, the book sticks to the class-based view for the rest of the examples.
The first project in the book is the pages app. It is not that special. It allows you to make posts from an admin panel. It is more of a preparation for the next projects in the book.
The first proper project in the book is a blogging application, and I talked about that here. You can find the source here. It implements all the CRUD operations for the database and goes through the views, URLs, and template process. During this process, the views for the application functionality are created, URLs are configured, and templates are written for the web pages. The code is written clearly and concisely, though I did end up causing a lot of my bugs due to typos and silly mistakes. One of them eluded me long enough that it ended up costing me an interview, adding insult to injury.
I must also confess that reading the long error messages of Django required me to remain patient because I often felt like the error was bouncing around from one file to another like a ping-pong ball. The author recommends focusing exclusively on your project files, and ignoring others, as we do not have any control over them. Which is a sound advice.
While I was also able to fix whatever problems appeared in my templates, one thing I do not claim to fix properly: and those are CSS bugs. I completely ignored those wherever I could, and I understand that is not a good look. But this is something where I cannot do anything about it, as a screen reader does not interact with the style of a web page properly for me to diagnose what has gone wrong. The fact that CSS does not produce any error messages also makes it difficult for me to diagnose what has gone wrong.
The next project in the book, and this is the final one, is a newspaper app. It pays homage to Django's roots, as it was created to manage a newspaper website. This project is huge. multiple chapters go by without even touching on the core functionality of the project, though the core functionality felt like the blogging application to me. This makes sense since writing articles is the main purpose of a newspaper website. The big features for me in this project were password reset, and email verification, two common functionalities that you will encounter on any website that allows you to make an account. Unfortunately, it required me to sign up for a service for email verification, which I did not end up doing because of reasons. So that functionality in my implementation is incomplete.
The final chapter of the book goes through some basic security measurements that a Django project has to take, and then the book concludes nicely enough. The author has two more books on Django, and I plan to go through them soon enough. Once I do, I will write reviews for them too.
I liked this book. The code was relatively bug-free, which seems to be an impossible standard in the technical books of this era, though I still recommend that you download the official source code of the book, just in case. You will find the link in the book itself. The explanations are nice and easy to follow, and I never felt that the author was concealing or making things more complicated than they had to be. The book remains focused on one task of teaching Django fundamentals, and it does it very well.
The only problem I see is that it uses Heroku for deploying these projects. While it is nice to know about what goes on in deploying a website once its code has been written down, the problem is Heroku has stopped offering its free tier that people like me could use to learn these things. The book has not been updated with a new edition, so the instructions remain where they still offer Heruko as a place to deploy the sites you have made in this book.
This is a risk for any book, not just this one. Services do not remain static forever, and though I am well aware that the process is general enough that any person can follow it along if they do some Google-fu, the reality is that it is a distraction, and an additional burden on the learner, through no fault of the author.
With that said, I do recommend this book for learning Django, especially if you have never encountered a framework before. It is a good book to pick up for people at the intermediate level of their programming journey, as well as people who are coming across web development in general. So yes, purchase this book, it is well worth it.
I hope this review is useful. Do leave a comment, especially if you have other technical books in mind that you would like to suggest to me. Also, check out my other blog here, and my web serial here. See you next time,
-Tanish.