Python

6 essays tagged Python · All articles

2026

  1. Decomposing hardcoded roles: rewriting access control in a Django app without breaking customers

    How we replaced three hardcoded roles with 46 named permissions and customer-defined roles, and proved nothing changed before changing anything.

    8 min read

  2. Migrating a production Django app from Elasticsearch to OpenSearch

    How a one-line urllib3 security bump turned into migrating a Django app from elasticsearch-py to opensearch-py, and what we vendored to keep the API responses unchanged.

    8 min read

  3. How I added project-aware tab completion to Django's manage.py

    Django's bundled bash completion only knows command names and flags. django-completion adds app labels and migration names by reading a JSON cache that is rebuilt after each manage.py command, so Tab never loads Django.

    3 min read

2025

  1. Django without the mess: repositories for data, services for rules

    Why selectors are a trap for cleaning up fat Django models, and how repositories for data access plus services for business rules keep the layers apart.

    7 min read

  2. Why Django REST Framework doesn't show your custom validation error messages (and what to do about it)

    DRF validates at the serializer level and skips model full_clean(), so custom messages on model constraints never reach the API response. Three ways to work around it.

    2 min read

  3. Boost your Django Docker images by using uv package and project manager

    A multi-stage Dockerfile for Django that installs dependencies with uv, uses cache mounts for faster rebuilds, and works around a .venv permission issue. In my project the build went from 34.6s to 15.8s.

    4 min read