Django 4.0 adds Redis database caching

Django 4.0 adds Redis database caching

Customisation, password hashing also addressed in latest version of Python-based framework.

Credit: Dreamstime

Django 4.0 has been released, centering on capabilities in database caching and forms customisation for the Python web framework.

A new Redis cache back-end offers built-in support for caching with the Redis in-memory database. Users will need a Redis server running either locally or on a remote machine. Python bindings for Redis also will be needed.

Also in Django 4.0, easier customising is offered for Forms, Formsets, and ErrorList, which are now rendered using the template engine. Released December 7, Django 4.0 can be installed with the pip package installer for Python:

pip install Django==4.0

Elsewhere in Django 4.0, according to release notes an *expressions positional argument of UniqueConstrain() enables development of functional unique constraints on expressions and database functions.

Meanwhile, a scrypt password hasher is more secure and recommended over the PBKDF2 algorithm but it is not the default, as it requires OpenSSL 1.1 and additional memory.

Other updates include that the Python standard library's zoneinfo now is the default timezone implementation in Django, the admin/base.html template now has a block header that contains the admin site header and the ModelAdmin.get_formset_kwargs() method allows customising of keyword arguments passed to the constructor of a form set.

In addition, the navigation sidebar has been fitted with a quick filter toolbar and a constant variable model, which contains the model class for each model, has been added to AdminSite.each_context().

Delving deeper, a ModelAdmin.search_help_text attribute allows for specifying descriptive text for the search box, jQuery has been upgraded from version 3.5.1 to 3.6.0 and the model section of admin docs now shows cached properties.

Furthermore, the PostgreSQL back-end now supports connecting by a service name, support has been dropped for PostgreSQL 9.6 while the Django test runner now supports a --shuffle option to execute tests in random order.

Django 3.0, which added support for Python async, was released roughly a year ago.


Brand Post

Show Comments