Django 3.2 Upgrade: Key Changes

The following are the changes introduced in Django 3.0 through 3.2 which seem most likely to impact Open edX developers once the upgrade from Django 2.2 to 3.2 is complete. Many more minor changes can be found in the changelogs for Django 3.0, 3.1, and 3.2. Some of these will be very useful for specific pieces of code, but probably aren’t of general interest to most Open edX developers; developers who can spare the time are encouraged to skim the changelogs at their convenience to see if there’s anything particularly useful for their work (or that they feel merits addition to the list of highlights below).

Changes Important to Upgrading

The following changes are important to be aware of when upgrading a library or service from Django 2.2 to 3.2, but not so much once the upgrade is complete. Again, this isn’t a comprehensive list (see the Django release notes for that), just the issues most commonly encountered when upgrading Open edX repositories.

  • Hashes for cookies and sessions switched from SHA-1 to SHA-256. To keep multiple server instances able to read each other’s data during the upgrade deployment, IDAs should set the DEFAULT_HASHING_ALGORITHM setting to “sha1”. Once the deployment is complete and we’re confident a rollback won’t be needed, this setting can then be removed again. [Changelog entry]

  • DEFAULT_AUTO_FIELD should probably be set to “django.db.models.AutoField“ for most repositories to streamline the upgrade, but after upgrading it is recommended to explicitly migrate or declare existing implicit ID fields so this setting can be removed and BigAutoField can be used for new ID fields.