Django Icon


Django is a web application framework for Python.
8 Stories
All Topics


Ban 1+N in Django

Alex Schepanovski:

I always thought of 1+N as a thing that you just keep in your head, catch on code reviews or via performance regressions. This worked well for a long time, however, the less control we have over our SQL queries the more likely it will sneak through those guards…

I tumbled on a couple of 1+Ns while reading a project code for an unrelated reason and it got me thinking – do I ever want Django to do that lazy loading stuff? And the answer was never.

Turns out the implementation of this is quite easy. ~15 loc for the naive version and ~35 for a more robust version. Give it a try if you, like Alex, never want to allow a 1+N in your Django app again.


Django 4.0 released

Highlights include built-in support for caching with Redis, more easily customizable forms and error lists, and standardizing Django’s timezone implementation to align with the Python standard library’s implementation. for the full list of goodies, check the release notes. Congrats to the entire Django team and community on the big release!

Side note: we haven’t done an episode on Django for many moons. Are we due? Who’d be the perfect guest you’d love to hear from on the topic?


Modern websites, JavaScript optional (Django + HTMX + Alpine)

Building a modern front end in Django without reaching for a full-blown JavaScript framework. Choosing the right tools for the job, and bringing them into your project.

This is as close to a tutorial as you’ll see on Changelog News. I’m linking to it not for the step-by-step bits like talking to your “Django backend without a full-page reload”, but for the decision making bits like “when you might choose low-JavaScript.”


Healthchecks – a watchdog for your cron jobs

I’ve wanted this for years, but apparently never enough to build it myself:

A passive monitoring tool written in Python & Django. Set up your cron jobs, backup scripts, weekly email sending scripts, nightly data import jobs etc. to ping this service when they complete. When they don’t send a ping on time, you receive an alert.

The service offers a generous 20 free checks before you start paying. And since it’s an open source Django app, you can set it up to run on your own infrastructure too.

Player art
  0:00 / 0:00