Paul Krill
Editor at Large

Django 4.0 adds Redis database caching

news
Dec 8, 20212 mins

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

python
Credit: Mark Gillow

Django 4.0 has just been released, centering on capabilities in database caching and forms customization 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 customizing 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.
  • 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.
  • 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.
  • The ModelAdmin.get_formset_kwargs() method allows customizing of keyword arguments passed to the constructor of a formset.
  • The navigation sidebar has been fitted with a quick filter toolbar.
  • A constant variable model, which contains the model class for each model, has been added to AdminSite.each_context().
  • 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.
  • The model section of admindocs now shows cached properties.
  • The PostgreSQL back end now supports connecting by a service name. Support has been dropped for PostgreSQL 9.6.
  • 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.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author