How to check Django version
This article is for checking the version of Django. When we create projects using Django and sometimes we might stuck where the version is not able to support certain functions of your code. There are many methods to check the current version of Django but you need Django installed on your machine.
Check Django Version using the Terminal
Example 1: To check the Django version for python3 open the terminal and write the command in your terminal:
python -m django --version
check the version by using this command in terminal
Example 2: Another way to check Django version for python3 is by using the below command.
django-admin --version
check the Django version in virtual env using this command
Example 3: You can also check django version while running the project.
python manage.py runserver
Django version
Check the Django Version using IDLE
To check Django version for python3 open your Python IDLE. Write the same line in your IDLE given below
import django
django.get_version()
import django
django.VERSION
use this command in python IDLE
Check Django Version using the pip
It gives all the current versions of python modules you installed in your system. Open your terminal and write the pip command in your terminal
pip freeze
or
pip list
both the command will give you information about all the installed Python packages in your current Python environment.
this show all modules installed in python
Checking Django Version from Within a Python Script
Open the project directory in your code editor after that open the file “manage.py” in the project directory and now Look for the line “import django” at the top of the file. Below this line, add the following code:
print(django.get_version())
Save the file and run the command “python manage.py” in the terminal.The Django version will be displayed in the terminal output.
Update Django Version for Python
If you want to update your Django version you can use any one of these commands to update your Django.
python -m pip install --upgrade Django
python -m pip install -U Django
# Python 3.8 to 3.11 supported only
python -m pip install django-upgrade
Upgrade or Downgrade your Django version for Python
Sometimes you want the specific version of django in your environment to work properly for this you can enter the version number to upgrade or downgrade your Django version using the below command.
pip install -v Django==3.0.5
By the we can install the specific version of the django for our project
Last Updated :
22 Aug, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...