1

I want to see the django version in my Pycharm terminal, but I don't get the correct method.

I tried bellow methods in pycharm terminal:

1) django --version and django version
2) import django, and print the version by:

import django
print django.VERSION 

But I still can not get it.

maer
  • 156
  • 3
  • 15
  • 1
    Possible duplicate of [How to check Django version](https://stackoverflow.com/questions/6468397/how-to-check-django-version) – doru Sep 10 '17 at 13:46

10 Answers10

2

If you cannot print the Django version from the python console in Pycharm, go to settings>Project:project_name>project Interpreter and from the list of installed packages see the installed Django and it's version for that project.

aspo
  • 374
  • 2
  • 9
1

You can run pip freeze too. Just filtering the results with grep...

pip freeze | grep Django
Kyle
  • 1,056
  • 5
  • 15
0

In the terminal you can use bellow command to check the version of django:

python -m django --version

If you want to use your second method, just like this bellow command:

python -c "import django; print(django.VERSION)"
(1, 11, 2, u'final', 0)
aircraft
  • 25,146
  • 28
  • 91
  • 166
0

You're trying to access a version attribute, but you can find out Django's version using the get_version method:

import django
django.get_version()
Mike Ru
  • 418
  • 3
  • 13
0

go to setting > project > project Interpreter and install Django package then run the code

import django

print(django.get_version())

imh1j4l
  • 95
  • 5
0

Run pip freeze > requirements.txt A .txt file with that name will be created automatically, open the file and check for the django version and other previously installed libraries.

0

I do not know about pychram but the most efficient way to query the django version without importing django globally would be this:

from django import VERSION as DJANGO_VERSION

if DJANGO_VERSION >= (2, 0):
    pass

What was not proposed in this question which is something similar: How to check Django version

npko
  • 1
  • 1
  • 2
0

I had the same question. The solution is simple. Just create a project, open settings.py file and observe the first comment lines. You will see the version info in there as displayed below:

Image of settings.py that shows the Django version

I found the solution here.

TechView
  • 3
  • 3
0

Simplest is

import django
print(django.get_version())
Yugandhar Chaudhari
  • 3,831
  • 3
  • 24
  • 40
0

Using the following command on terminal will give you django version

 python -m django --version

Or You can go to the interactive python prompt and use the command

import django
print(django.get_version())

or using pip freeze and grep you can also get the django version

pip freeze | grep Django
Hasidul Islam
  • 324
  • 3
  • 12