How to Check Django Version – Ultimate Guide 2020
Tags: django, python
Published: 2020-08-21 08:27:26

There are different ways you can check your django version. In this article I will share a couple of them. I will also share how you can upgrade and downgrade the django version. How you can uninstall django, something that you might do if you are running into problems and decide to uninstall it and install Django again.

Finding the django version can be useful if you want to make sure your python and django versions are compatible. I have also included a section to show how to find the python version that you are using.

Find your django version can also be useful to make sure a feature you are using, is supported that the django version installed

{% youtube kuEppJuqFIU %}

#How can I check Django version?

The way you check your Django version depends on if you installed Django on you base python installation or you installed the module in a virtual environment. Let’s see first how to check your version on the base python installation.

##Checking Django version with Idle

To achieve this, open the idle terminal and type the following:
```python
import django
django.get_version()
```
Output(you should get something similar):
```
'3.0.8'
```
You could also use the following code, that will return the same results, but slightly different format:

```python
import django
django.VERSION
```
Output:
```
(3, 0, 8, 'final', 0
```
##Checking Django version with pip

You can also check the version through pip using. Run the following command on your terminal:
```
pip3 freeze
```
Output:
```
Django==3.0.8  # Django version
docutils==0.14
dominate==2.5.1
Flask==1.1.1
Flask-Bootstrap==3.3.7.1
importlib-metadata==1.6.0
```
If django is in your python installation, it will be listed along with any other module installed.

[Check out your django version in a virtualenv or using the django scripts](https://www.hicodeclub.com/how-to-check-django-version-ultimate-guide-2020/)

#Upgrade Django version
You can upgrade django and any module installed using the pip command. You can run the following command from your terminal, or the Pycharm terminal. As before, if you are working on a virtual environment, make sure you activate the environment before running the command:
```
pip install --upgrade django
```
This will upgrade to the latest available version

#Downgrade Django version
In case you would like to downgrade, you can do this via pip as well, using the following command:
```
pip install -v Django==3.0.5 #Replace with your version
```
You can find a list with all the available django version here

As before in case you are working on a virtualenv, make sure it is activated. Or if you have several python version installed in your computer, make sure your pip command you are using belongs to the python installation you are using to run your python program. You can check this by running the linux which command from your terminal. 
```
which pip
```
The output should be same folder or subfolder as where your python version is installed.

Check out [the following article](https://www.hellocodeclub.com/how-to-check-django-version-ultimate-guide-2020/) to see how to install and uninstall python, and see your local python version