“Boost Your Django DX” Released

The book mascot: Esther the Enhanced Equine.

My new book, Boost Your Django DX is out now. I’m so glad it has shipped and I can relax, a bit 😅

If you didn’t see it yet, here’s the short blurb:

During my years working with Django, I’ve picked up many tools and techniques to boost my Developer Experience, or DX. This book covers as many of these as possible, so you can learn them too!

Many thanks to the 188 people who preordered: you should all receive an email from Gumroad. If you didn’t preorder, you can buy now at full price. It’s $39 for an individual license, with higher tiers for team licenses. It comes as a watermarked PDF, an ePub, an AZW3 (Kindle), and a zip file of resources.

Full Table of Contents

Here is the full table of contents in this first version:

  1. Origin
    1. This Book, and Not This Book
    2. Read in Any Order
    3. On the Included Examples
    4. Acknowledgements
    5. Changelog
  2. Documentation
    1. DevDocs: The Free Rapid Documentation Tool
      • Get Started and Set Up Django’s Docs
      • Perform a Basic Search
      • Search a Single Documentation Source
      • Reset the Search Box
      • Visit the Original Documentation Site
      • Download Documentation Sources for Offline Use
      • Useful Documentation Sources
      • More on DevDocs
    2. DuckDuckGo: A Developer-Friendly Search Engine
      • Access DuckDuckGo
      • Keyboard Shortcuts
      • Bangs: Shortcuts to Other Search Pages
      • Instant Answers: Expanded Results on the First Page
    3. Bonus Django Documentation Sites
      • Classy Class-Based Views
      • Classy Django Forms
      • Template Tags and Filters
      • Classy Django REST Framework
      • Awesome Django
    4. Wget: Download Any Website
      • Install
      • How to Download a Website
      • Example: The Django REST Framework Documentation
      • Read Offline Documentation With Python’s Web Server
      • An Explanation of All the Flags
    5. Miscellaneous Tips and Tricks
      • Python Documentation
      • Django Documentation
      • Read the Docs
      • Sphinx
  3. Virtual Environments and Dependencies
    1. On Tools and Choice
    2. Virtual Environments
      • How to Create a Virtual Environment
      • Avoid Committing Your Virtual Environment
      • Activate a Virtual Environment
      • Deactivate a Virtual Environment
      • Maybe Use virtualenv Instead of venv
    3. Pip and Extra Tools
      • Invoke Pip Safely
      • The Problems With "pip freeze > requirements.txt"
      • pip-compile: Simple Dependency Management
      • Convert an Existing "requirements.txt" File to "pip-compile"
      • Add a New Dependency With "pip-compile"
      • Remove a Dependency With "pip-compile"
      • Upgrade Dependencies With "pip-compile"
      • pip-lock: Keep All Environments Up to Date
    4. Dependency Management
      • (Probably) Stick to a Single Set of Dependencies
      • Pick New Dependencies Carefully
      • Set a Dependency Upgrade Schedule
    5. Python’s Development Mode
      • Enable Development Mode
      • Check if Development Mode is Enabled
      • When to Use Development Mode
  4. Python Shell
    1. IPython: a Superior Python Shell
      • How to Install IPython
      • How to Get Help
      • Press Tab for Advanced Autocomplete
      • Reuse Results with the Output History
      • Export and Rerun Code With the Input History
      • Copy in Code With Multi-Line Paste And "%cpaste"
      • Benchmark Code With "%timeit"
      • Improved Debugging with IPython’s debugger
      • Use IPython’s Debugger Outside of IPython
    2. django-read-only: Production Data Protection
  5. Development Server
    1. django-debug-toolbar: A Development Boon
      • Install and Configure
      • Explore the Toolbar
      • Find Problematic Database Queries with the SQL Panel
      • Trace Non-HTML Requests With the History Panel
    2. Watchman: Fast, Efficient Autoreloading
      • Install and Set Up Watchman
      • Manage Watches with the Watchman CLI
    3. django-browser-reload: Automatically Reload Your Browser in Development
      • Reloads Triggered by Template Changes
      • Reloads Triggered by Static Asset Changes
      • Reloads Triggered by Code Changes
      • Installation
    4. Rich: Beautiful Terminal Output
      • Server Logs
      • Management Commands
  6. Code Quality Tools
    1. EditorConfig: Consistent Text Editing
    2. pre-commit: A Code Quality Framework
      • What pre-commit Is
      • Install pre-commit
      • Add a Configuration File
      • Configuration Structure
      • Pin The Version of Python Used for Hooks
      • Various Ways to Run Hooks
      • Update Hooks With "pre-commit autoupdate"
      • Run Pre-Commit in CI With pre-commit ci
      • Introduce a Hook Incrementally
    3. Black: The Uncompromising Code Formatter
      • How Black Formats Code
      • Install and Configure Black
      • blacken-docs: Apply Black to Documentation
    4. isort: Sorted, Grouped Import Statements
      • isort’s Style
      • Install and Configure isort
      • Add or Remove Imports from Every File
    5. Flake8: An Extensible Linter
      • Install and Configure Flake8
      • flake8-bugbear: Extra Checks for Common Problems
      • flake8-no-pep420: Avoid Package Problems
      • Further Plugins
  7. Further Code Quality Tools
    1. pyupgrade: Upgrade to the Latest Python Syntax
      • Some Example Rewrites
      • Install and Configure
    2. django-upgrade: Upgrade to the Latest Django Features
      • Example Rewrites
      • Install and Configure
    3. pre-commit-hooks: General Purpose Checks
    4. reorder_python_imports: An Alternative Import Sorter
      • One Import Per Line
      • Rewrite Old Imports
    5. curlylint: A Template Linter
      • Some Example Errors
      • Install and Configure
    6. DjHTML: A Template Formatter
      • Example Re-indentation
      • Install and Configure
    7. Mypy: Check Your Types
    8. Prettier: Format Your CSS, JavaScript, and More
      • Supported Languages
      • Example JavaScript Formatting
      • Example CSS Formatting
      • Install and Configure
      • Format More Languages With Plugins
    9. ESLint: The Top JavaScript Linter
      • Example Lint Errors
      • Install and Configure
      • Use a Base Config
    10. ShellCheck: Find Bugs in Your Shell Scripts
      • An Example
      • Install
  8. Build Your Own Tools
    1. pre-commit’s Virtual Languages: Rapid Checks
      • Write a Custom “Fail” Hook
      • Write a Custom Regular Expression Hook
    2. Flake8 Plugin: Custom Source Code Checks
      • The Abstract Syntax Tree (AST)
      • Further AST Exploration
      • Plugin Structure
      • Make a Plugin to Ban "lambda"
      • Test Your Plugin
      • Further Reading
    3. Write a Custom Tool
      • Replace Django Documentation Links
      • What pre-commit Expects of Tools
      • Make a Tool
      • Example Usage
      • Run the Tool With Pre-Commit
      • Add Tests
  9. Settings
    1. Structure Your Settings
      • Use a Single Settings File with Environment Variables
      • Load a ".env" File Locally
      • Settings in Tests
      • Group and Sort Settings
      • Order "INSTALLED_APPS"
      • Use "pathlib" for "BASE_DIR"
      • A Settings File Template
    2. Some Settings Patterns to Avoid
      • Don’t Read Settings at Import Time
      • Avoid Direct Setting Changes
      • Don’t Import Your Project Settings Module
      • Avoid Creating Custom Settings Where Module Constants Would Do
      • Name Your Custom Settings Well
      • Override Complex Settings Correctly
    3. Test Your Settings File
      • Test Your Settings Functions
      • Test Your Settings Logic
  10. Models and Migrations
    1. Seed Your Database with a Custom Management Command
      • The Various Approaches
      • Create a Command
      • Test Your Command
    2. Factory Boy: Easier Data Generation
      • Install and Define Factories
      • Invoke Factories
      • Use Factories in Tests
      • Use Factories in "seed_database"
      • Further Tools
    3. Migration Safeguards
      • Test for Pending Migrations
      • Disallow Auto-Named Migrations
      • django-linear-migrations: Prevent Merge Migrations
  11. System Checks
    1. How System Checks Work
      • The Basics
      • How to Silence Checks
      • The Advantages of Checks
    2. Write Your Own Checks
      • How to Write a Check Function
      • How to Register a Check Function
      • Add a Check for Python’s Development Mode
      • Add a Check for Model Class Names
    3. Test Your Checks
      • Test the Development Mode Check
      • Test the Model Name Check
    4. Further Places That Checks Live
      • Model Class Checks
      • Model Field Checks
    5. django-version-checks: Keep Your Environments in Sync
      • Install and Configure
      • Upgrading Dependencies
  12. Terminus
    1. Further Reading
    2. Thank You


I’d like to thank everyone who has helped me assemble this book. It is the result of many years of working with Django so I can’t possibly cover everyone. I’ve been influenced by all of my friends in the Python and Django worlds, anyone whose talk I attended, and everyone I’ve worked with. And there are also many people who’ve created, maintained, or contributed to the all the tools mentioned within. I’m thankful for all of this, and really enjoy being part of this community.

I’d like to particularly thank all beta readers, who all gave me great feedback:

For hosting me on the Django Chat podcast, thanks to Carlton Gibson and Will Vincent. For recently working with me and allowing me to think about DX, I’d like to thank Chris Darby and all of ev.energy, Rupert Baker, Charlie Shufeldt, and Jeroen Janssens.

I would also like to thank my partner Mafalda provided unwavering love and support, especially through difficult times. And similarly, I am grateful for the support of my parents, brother, sister-in-law, mother-in-law, and extended family.

For wake-up calls and energizing morning walkies, I thank Kevin, the puppy.

Future Updates

I’m sure I’ll be making several updates in the future. I imagine there will be some small edits post-release, and I also aim to keep it updated for future Python and Django versions. Speaking of which, it’s time to update Speed Up Your Django Tests


May your development experience improve in a 2022-01-10-esther.jpg .. —AdamEsther The book mascot: the Enhanced Equine.

Subscribe via RSS, Twitter, Mastodon, or email:

One summary email a week, no spam, I pinky promise.

Related posts: