Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
How to check Django version?
Django is a free, open source web framework written in Python that follows the Model-View-Controller (MVC) architectural pattern. It's designed to help developers build web applications quickly and efficiently with minimal complexity.
The key features of the Django framework include:
Object-Relational Mapper (ORM) for database management
URL routing and HTTP request/response handling
Template engines for generating HTML pages
Built-in user authentication and administration
Support for third-party modules and packages
Community support and comprehensive documentation
Django is widely used by organizations like Google, Pinterest, Mozilla, and Instagram for building scalable and robust web applications.
Installing Django
Before checking the Django version, you need to install it on your system using pip:
pip install django
The installation output will show the Django version being installed:
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)
Collecting sqlparse>=0.2.2
Downloading sqlparse-0.4.3-py3-none-any.whl (42 kB)
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
Using Command Line Interface
The quickest way to check Django version is through the command line:
python -m django --version
This command outputs the installed Django version:
4.2.1
Using django.get_version()
Django provides a built-in get_version() function to retrieve the version programmatically:
import django print(django.get_version())
4.1.7
Using Django Shell
You can check the version from within a Django project using the Django shell:
python manage.py shell import django print(django.get_version())
Using pip show Command
If Django was installed using pip, you can view detailed package information including the version:
pip show django
This command displays comprehensive package information:
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:
Comparison of Methods
| Method | Use Case | Output |
|---|---|---|
python -m django --version |
Quick command-line check | Version number only |
django.get_version() |
Programmatic access | Version number only |
pip show django |
Detailed package info | Full package details |
Conclusion
Use python -m django --version for quick version checks, django.get_version() for programmatic access, or pip show django for comprehensive package information. All methods provide reliable ways to verify your Django installation version.
