Posts tagged ‘django’


A Django REST API in a Single File

A cat having a small REST

I previously covered writing a Django application in a single file, for both synchronous and asynchronous use cases. This post covers the angle of creating a REST API using Django in a single file.

Read more...

Prevent Unintended Data Modification With django-read-only

So you want write privileges hey?

Last week I released a new Django package, django-read-only. It provides a read-only mode for Django’s database layer.

Read more...

How to Unit Test a Django Management Command

Here comes the test train!

This post is an adapted extract from my book Speed Up Your Django Tests, available now.

Read more...

What happens when you run manage.py test?

A tangle of classes

This is a blog post version of the talk I gave at DjangoCon Australia 2020 today. The video is on YouTube and the slides are on GitHub (including full example code).

Read more...

Bonus Django Documentation Sites

Baby Reading

There are a few mini sites out there with “bonus” Django documentation. Here’s a list of the best ones I know of.

Read more...

Django and the N+1 Queries Problem

Snakey snake

This is a cross-post from the Scout APM blog, where I occasionally write. I also maintain the Scout Python integration.

Read more...

Backporting a Django ORM Feature with Database Instrumentation

Backwards like this ancient “lizard”

Last week I covered Django’s database instrumentation, and making a wrapper that’s always installed. Here’s a different use case that I encountered last year on a project.

Read more...

How to Modernize a Django Index Definition with Zero Downtime

Book Index

If you’ve read the Django documentation for Model.Meta.index_together recently, you may have noticed this note:

Read more...

How to Make Always-Installed Django Database Instrumentation

Mandolin

Since version 2.0, Django has provided a hook for installing database instrumentation wrapper functions. These functions are like middleware for database queries, allowing you to inspect and rewrite SQL before it is sent to the database. There are many use cases, for example:

Read more...

How to Use Django's Parallel Testing on macOS With Python 3.8+

Fork or Spoon?

This post is an adapted extract from my book Speed Up Your Django Tests, available now.

Read more...

All tags: