Function-based views are typically easy for beginners to understand. Just create a function that receives a request object and returns a response object. But class-based views (CBV) tend to cause more confusion. Most of the functionality lives in out-of-sight base views and mixins, so using a CBV usually means overwriting a handful of class attributes […]
Django’s class-based views are powerful and customizable, but unless you have a solid mental model of how they work, they’re also confusing and tricky to master. It’s easy to use class-based views without a deep understanding of their inner workings, which leads to Googling for which method or attribute to modify rather than confident usage […]
If you’ve ever written a program and printed out a value to see what’s going on during execution, then you understand at some level why logging is so valuable. Knowing what’s happening in your code at a point in time is enormously useful from both technical and business perspectives. This knowledge lets developers and product […]
Today’s post is the first of a four-part series on how Django’s setup process works. Specifically, we’ll focus on how Django accesses project settings.
In the last post we looked at how a request gets from the internet to the front door of Django, the wsgi.py file. WSGI, which is short for Web Server Gateway Interface, is the topic of today’s post, as it lays the groundwork for understanding how Django handles requests. We’ll cover the key components of […]