Recent Posts (Page 2)

How to Make Django Raise an Error for Missing Template Variables

Who dropped the {{ variable }} ?

It’s all too easy to forget to pass a variable to your template, or make a typo in a variable name. Unfortunately, it can be quite hard to debug such mistakes, since Django’s default behaviour is to ignore the problem and render an empty string.


You Probably Don’t Need Django’s get_user_model()

Which way to the User model?

Django’s authentication system, django.contrib.auth, provides a built-in User model class. You can swap this to a different class with the AUTH_USER_MODEL setting, most easily at the start of the project.


How to Lock Your Project’s Node.js Version

I’m chicken you have the right Node.js!

It’s a good idea to ensure your project uses the same Node.js version in all environments. This way you can be sure that your code will work as expected, from development to production.


How to Squash and Rebase a Git Branch

We gotta Git out of this place.

It can be tiresome to rebase feature branches with many commits. You may have several commits that conflict with your main branch. Before rebasing such branches, you may want to squash your commits together, and then rebase that single commit, so you can handle all conflicts at once. Here’s how to do that.


How to Run a Command on Many Files in Your Git Repository

Git getting you feeling crabby?

Occasionally it’s useful to run commands on files in your repository, or all files matching a pattern. This is possible by combining git ls-files and xargs.


django-htmx Now on Read the Docs

Artist’s impression of my writing desk.

I’ve just released django-htmx 1.9.0. As part of this release, it now has a documentation site built with Sphinx, hosted on Read the Docs at


Announcing WhiteNoise 6

I guess, like the white keys let you make noise, white - noise, whitenoise. Get it?

WhiteNoise is a simple solution to serving static assets. It lets you skip configuring a separate web server for your static assets, and serve them straight from Django. It’s a brilliant tool. I’ve used it for years on various projects, and I’ve recommended it many times, and mentioned it in several blog posts.


Appearance on Podcast.__init__


I joined host Tobias Macey on Podcast.__init__, in Episode 349, published this monday. The episode is titled “Improve Your Productivity By Investing In Developer Experience Design For Your Projects”. We covered various topics related to “developer experience” and general ways to improve it on any Python project.


How to Set Up Source Maps with Django

“Now where on this map is node_modules?”

Source maps are files that map your minified CSS or JavaScript back to the original code. They allow you to use your browser’s development tools to debug minified code as if it were the original. Also some error capture tools, such as Sentry, can use source maps to report errors for the original code.


A Problem with Duplicated Mutable Constants

Hey! You’re just like me!

Here’s a small problem I’ve seen where several modules share versions of the same “constant” variable. It came up in the context of a Django project with multiple settings files, but it could happen in different contexts.