Today I’m launching the Django 4.0 and Django REST Framework 3.13 update to my book Django for APIs. Readers who purchased the digital version on Gumroad can log in to their accounts there and download the update for free.

This is a major update and essentially rewrite of the previous version. There are many changes large and small that will be listed below but the biggest ones are Windows support as opposed to just macOS, a switch to Pip from Pipenv, pages of new content on testing APIs, production deployment, updates in documenting web APIs, and much more.

DFA 4.0

What’s New for 4.0

In bulleted format here is what’s new in the 4.0 update:

  • Django 4.0 and Django REST Framework 3.13 throughout.
  • Updated to Python 3.10.
  • Added full chapter on proper set up with Python, Django, Black, Git, and more.
  • Switched to Pip from Pipenv, which is a major change but feels warranted given Pipenv has slowed in development and Pip is the default for many people. I don’t get into fancier configuration options because “it all depends” once you do and using Pip is fine for a single developer starting out.
  • Windows-first support. I bought a Microsoft Surface laptop and have been dutifully using it several days a week. I still greatly prefer macOS but most of the world uses Windows so I have run through all the code and updated the text to ensure Windows works well.
  • Updated all the third-party packages to the latest versions, which means django-cors-headers, django-rest-auth, django-allauth, gunicorn, psycopg, whitenoise, and environs.
  • Added environment variables for proper security and deployment
  • Much more material on testing both Django and Django REST Framework in all projects
  • Deployment configured in depth for all 3 projects built in the book
  • Fixed a previous bug in Chapter 7 around permissions so it is properly locked down now. Also covers custom permissions in far more depth.
  • Switched the default project name from config to django_project to avoid any confusion among readers.
  • Switched to drf-spectacular for documentation in align with recent Django REST Framework trends
  • Switch from pip install to python -m pip install because Adam Johnson said to.
  • All new screenshots since Chrome updates even more often than Django.
  • Switch to main from master for Git branch.
  • Added static files to an otherwise empty static/ folder that wasn’t being picked up by Git.

Thoughts

The main goal for this update was to include more material so that this book is equally in-depth and advanced as Django for Professionals. I’m often asked by readers which book they should read next after Django for Beginners and while I think all three books have merit it really depends on the immediate need of the developer. If your goal is to write web APIs quickly it’s ok to go right to this APIs book and later do Professionals. If your goal is to do production websites without needing an API, it’s ok to do Professionals and then later APIs to fill out your understanding.

It’s an interesting process doing major rewrites to existing books. On the one hand it’s not as rewarding or fun as creating something new from scratch. There is less of a fulfilling of satisfaction from an update versus something totally new. On the other hand, the fact that all three books continue to sell well affords me the time to devote to improving each of them every 8 months in line with Django’s release schedule.

I don’t anticipate such a major update for the 4.1 and 4.2 versions of my books but having a major re-write on the .0 releases, meaning 5.0 will be the next big update, is much more mangeable for me than trying to do such a lengthy rewrite each time.

Next up is the Django for Professionals 4.0 update. I have a long list of improvements for that book as well: adding Windows support, switching to Pip, taking advantage of new Django features, updating Docker, and so on. Hopefully that can be completed and released this spring.