How to check Django version?


Django is a free, open source web framework which is written in python and works with the python language. It follows the Model view controller(MVC) architectural pattern. This is manly used to develop the web applications in an easy and faster way with minimal fuss.

The key features of the Django framework are as follows.

  • It provides Object – relational mapper (ORM) for database management.

  • It helps in URL routing and handling of HTTP requests and responses.

  • Provides the templating engines to generate the HTML pages.

  • It has built-in user authentication and administration

  • Django supports the third party modules and packages

  • It has a community support and user understandable comprehensive documentation.

Django is widely used Web Framework in most of the organizations like Google, pinterest, Mozilla, Instagram and so on as it build scalable and robust web applications.

Installing Django

Before checking the version of the Django, we should install it our machines. The following code is used to install the frame work.

pip install django 

The following will be returned as the output after installing django in our machine.

Collecting django
  Downloading Django-4.1.7-py3-none-any.whl (8.1 MB)
     ---------------------------------------- 8.1/8.1 MB 391.5 kB/s eta 0:00:00
Collecting tzdata
  Downloading tzdata-2022.7-py2.py3-none-any.whl (340 kB)
     ------------------------------------ 340.1/340.1 kB 469.3 kB/s eta 0:00:00
Collecting sqlparse>=0.2.2
  Downloading sqlparse-0.4.3-py3-none-any.whl (42 kB)
     -------------------------------------- 42.8/42.8 kB 260.2 kB/s eta 0:00:00
Collecting asgiref<4,>=3.5.2
  Downloading asgiref-3.6.0-py3-none-any.whl (23 kB)
Installing collected packages: tzdata, sqlparse, asgiref, django
Successfully installed asgiref-3.6.0 django-4.1.7 sqlparse-0.4.3 tzdata-2022.7
Note: you may need to restart the kernel to use updated packages

There are different ways to check the version of the django web framework. Let’s see each process one by one.

Using Command Line Interface

In command prompt or terminal, we can check the installed version of the django framework using the following code.

python -m django --version

Output

F:\>python -m django --version
4.2.1

Using the django.get_version()

Django provides a function namely get_version(), to check the installed version of django in your local system.

import django
print(django.get_version())

Output

4.1.7

Using Django shell

The installed version of django can be checked by running the following code in django shell.

python manage.py shell
import django
print(django.get_version())

Using the package info

If we have installed the Django framework using ‘pip’, then we can find the version of it in the package information –.

pip show django

Output

Following is the package information of django in which the version is also present.

Name: Django
Version: 4.1.7
Summary: A high-level Python web framework that encourages rapid development and clean, pragmatic design.
Home-page: https://www.djangoproject.com/
Author: Django Software Foundation
Author-email: foundation@djangoproject.com
License: BSD-3-Clause
Location: c:\users\test\anaconda3\lib\site-packages
Requires: asgiref, sqlparse, tzdata
Required-by: 
Note: you may need to restart the kernel to use updated packages.

Updated on: 09-Aug-2023

231 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements