Django 3 Adds Support For ASGI
Written by Kay Ewbank   
Friday, 13 December 2019

There's a new version of Django, the high-level Python Web framework that lets you create dynamic websites. Django takes care of user authentication, content administration, site maps and RSS feeds to make website development easier.

The main change to Django is support for running as an ASGI application. This is the first step to Django fully async-capable. ASGI (Asynchronous Server Gateway Interface) is intended to provide a standard interface between async-capable Python web servers, frameworks, and applications. Where WSGI provided a standard for synchronous Python apps, ASGI provides one for both asynchronous and synchronous apps.

django

The new support for ASGI in Django is in addition to the existing WSGI support, and the developers plan to support both for the foreseeable future, though async features will only be available to applications that run under ASGI. The developers point out that as a side-effect of this change, Django is now aware of asynchronous event loops and will block you calling code marked as “async unsafe” - such as ORM operations - from an asynchronous context.

On the database side, Django now supports MariaDB 10.1 and higher. However, to use MariaDB you do need to use the MySQL backend, which is shared between the two.

Custom enumeration types have been added as a way to define Field. choices. TextChoices and IntegerChoices types are provided for text and integer fields, while a Choices class can be used to define a compatible enumeration for other concrete data types. These custom enumeration types support human-readable labels that can be translated and accessed via a property on the enumeration or its members.

The other main improvement is to filter expressions. Expressions that output BooleanField can now be used directly in QuerySet filters, without having to first annotate and then filter against the annotation.

Django 3 can be downloaded from the Django project's download page.


 django

More Information

Django Project Website

Related Articles

Django 1.3 released

Komodo 10.2 Adds Slack Sharing

 

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Harvard RoboBee Gets New Knees
25/04/2025

The Harvard RoboBee can now make better landings thanks to new legs based on those of a crane-fly.  The researchers who developed the robot say it now no longer needs to crash land, and can inste [ ... ]



$20,000 If You Can Make This Rust Program As Fast As C
19/05/2025

This is a storm in a Rust bucket. Prosimo decided that a good test of Rust was to convert the existing dav1d decoder from C to Rust. Everything seems to have gone well, but the Rust version is still 5 [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info