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
  • 135
  • 3
  • 14
  • 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

9 Answers9

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
  • 349
  • 2
  • 9
1

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

pip freeze | grep Django
Kyle
  • 1,008
  • 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
  • 20,821
  • 22
  • 79
  • 154
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
  • 396
  • 2
  • 12
0

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

import django

print(django.get_version())

imh1j4l
  • 97
  • 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.

0

Simplest is

import django
print(django.get_version())
Yugandhar Chaudhari
  • 3,469
  • 2
  • 22
  • 36