DEV Community

Priyanshu Panwar
Priyanshu Panwar

Posted on

4 1

Django 2.x V/S Django 3.x

In this article, we'll talk about the new features added to Django 3.x and their differences, though Django 2.2.x still has a Long Term Support. (I still use Django 2.2.6)
Before we start, Both Django versions work very well with Python 3.x, though one might feel some problem with some libraries in Django 2.x for python 3.6+(in rare libraries).

New Features added in Django 3.x

MARIA DB

Django 3.x comes in support with Maria DB. This might not effect most of the django programmers but for those who are fans of this open source MYSQL database.
This is how you can use MariaDB in your django project.

# settings.py
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'OPTIONS': {
            'read_default_file': '/path/to/my.cnf',
        },
    }
}
Enter fullscreen mode Exit fullscreen mode
# my.cnf
[client]
database = NAME
user = USER
password = PASSWORD
default-character-set = utf8
Enter fullscreen mode Exit fullscreen mode

ASGI in Django - Biggest Upgrade of 3.x

  • Django 3.0 is now fully async-capable, it provides support for running as an ASGI application in addition to the existing WSGI support.
  • ASGI (Asynchronous Server Gateway Interface) is a spiritual successor of WSGI, intended to provide a standard interface between async-capable Python web servers, frameworks and applications. Let's take a simple example to see the working of async python in django.
async def application(scope, receive, send):
    event = await receive()
    ...
    await send({"type": "websocket.send", ...})
Enter fullscreen mode Exit fullscreen mode

These two features are the main upgrades in the Django 3.0
If you are looking to work with MariaDB or want to use the power of async python, then definitely upgrade to Django 3.0

THANK YOU

Feel Free to ask me anything in comments or reach out to me directly. Priyanshu Panwar | LinkedIn

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay