All articles tagged Django

Thumbnail image for High Performance Django Is Free Online

High Performance Django Is Free Online

In 2014 Yann Malet and I (with the help of the rest of the team here) wrote a book about building and scaling Django websites. It was the culmination of things we’d learned from, at the time, close to a …

Thumbnail image for Distributed Locking in Django

Distributed Locking in Django

As you start scaling an application out horizontally (adding more servers/instances), you may run into a problem that requires

distributed locking

. That’s a fancy term, but the concept is simple. Sometimes you have to be sure that when a …

Thumbnail image for Single-file Python/Django Deployments

Single-file Python/Django Deployments

This post covers portions of my talk,

Containerless Django

, from DjangoCon US 2018.

Deploying Python has improved significantly since I started working with it over a decade ago. We have virtualenv, pip, wheels, package hash verification, and

lock

files …

Thumbnail image for Cracking Django Password Hashes

Cracking Django Password Hashes

Most of the Django projects I work with take advantage of

django.contrib.auth

. It manages users and groups and is tightly coupled with

django.contrib.admin

. In this post, we are going to explore how it resists a potential attacker.

The …

Thumbnail image for Goodbye manage.py

Goodbye manage.py

Every Django project starts with a

manage.py

file in its root. It’s a convenience script that allows you to run administrative tasks like Django’s included

django-admin

.

In

our last post

, we discussed the merits of including a

setup.py …

Thumbnail image for Django Logging, The Right Way

Django Logging, The Right Way

Good logging is critical to debugging and troubleshooting problems. Not only is it helpful in local development, but in production it’s indispensable. When reviewing logs for an issue, it’s rare to hear somebody say, “We have too much logging in …

Thumbnail image for Disabling Error Emails in Django

Disabling Error Emails in Django

One of Django’s nice “batteries included” features is the ability to send emails when an error is encountered. This is a great feature for small sites where minor problems would otherwise go unnoticed.

Once your site start getting lots of …

Thumbnail image for Django Patterns: Fat Models and cached_property

Django Patterns: Fat Models and cached_property

One of my favorite patterns in Django is the combination of “fat” models and

cached_property

from

django.utils.functional

.

Fat models are a general MVC concept which encourages pushing logic into methods on your Model layer rather than the Controller (“view” …

Thumbnail image for Django Anti-Patterns: Signals

Django Anti-Patterns: Signals

Django’s

Signal Dispatcher

is a really powerful feature that you should never use. Ok, it has valid use cases, but they may be rarer than you think.

First, to dispel a misconception about signals, they are not executed asynchronously. There …