Django v4 Release

In December 2021 Django Version 4 was released with various upgrades to the framework, improvements, deprecations, and a few breaking changes. This article is a quick overview of this update. Thanks for reading!


Django 4.0 highlights

zoneinfo default time zone

In this version the default pytz time zone has been migrated to zoneinfo

Template-based form rendering

Forms, Formsets, and ErrorList are now rendered using the template engine to enhance customization.

RedisCache backend

provides built-in support for caching with Redis

scrypt password hasher

This new password hasher is more secure compared to PBKDF2 (the default hashing algorithm before v4)


Deprecated Features

PostgreSQL v9.6 support

PostgreSQL v9.6 and earlier are not supported by Django v4.0. Django v4.0 will only support PostgreSQL ≥v10.

Oracle v12.2 and 18c

Starting with Django 4, the Oracle version should be at least v19 or above. The Django team has officially removed support for Oracle versions 18c and earlier.


Breaking Changes

CSRF_TRUSTED_ORIGINS changes

Values in the CSRF_TRUSTED_ORIGINS setting must include the scheme (e.g. 'http://' or 'https://') instead of only the hostname. Also, this might be required in the project configuration.

# settings.py sample (partial content)
...
ALLOWED_HOSTS        = ['localhost', 'localhost:85', '127.0.0.1']
CSRF_TRUSTED_ORIGINS = ['http://localhost:85', 'http://127.0.0.1']
...

Django v4 Release - CSRF_TRUSTED-ORIGINS Sample


Starters Upgraded to v4

For the full list and support, please access the AppSeed platform.

Soft UI Design - Django 4 Starter

Thanks for reading! For more resources, feel free to access: