17

this is the first time i use django. I'm really a beginner. And this is the first time i see the page "It worked! Congratulations on your first Django-powered page.". it's mean i'm now have a django+python in my xampp server. So i cam to the question ?

  1. How to know what django version i use? is it 1.0, 1.1, or 1.2 ?
  2. where i can read it in my django folder (a file name) and how i can use code/function to print the django version ?
  3. is there any subtitute for phpinfo() in python ?
justjoe
  • 5,454
  • 9
  • 44
  • 64
  • [`python -c "import django; print(django.get_version())"`](http://stackoverflow.com/a/16805125/673991) – Bob Stein Nov 13 '15 at 16:08
  • Does this answer your question? [How to check Django version](https://stackoverflow.com/questions/6468397/how-to-check-django-version) – Frank Oct 13 '21 at 08:16

5 Answers5

37

As to your first question:


jcomeau@intrepid:/usr/src/unternet$ python
Python 2.6.6 (r266:84292, Oct  9 2010, 11:40:09) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_version()
'1.2.3'
jcomeau_ictx
  • 37,688
  • 6
  • 92
  • 107
  • 1
    hopefully that answers your 2nd question also. as to the 3rd: I don't know yet (I'm just starting with it myself) but I suspect the answer is "no", at least not on the same scale as phpinfo(). – jcomeau_ictx Nov 11 '10 at 06:11
  • that actually is really good for older version of django then 11,as from that one is used django-admin --version, but it did not worked for another project where indeed django is 10.4(and I was getting ImportError: No module named 'django' – Carmine Tambascia Aug 31 '17 at 21:41
9
import django
django.VERSION
soulseekah
  • 8,770
  • 3
  • 53
  • 58
2
python manage.py runserver

Output:

Validating models...

0 errors found February 27, 2015 - 14:25:41 Django version 1.6.5, using settings ... ....

Community
  • 1
  • 1
Octo
  • 241
  • 2
  • 7
2

For the third question, you can get the list of available modules from the interpreter prompt:

>>> help()

help> modules

This will (eventually) give you a list of available modules.

For other info, you can use the sys module:

import sys

sys.version # Python version
sys.platform # platform
aaronasterling
  • 68,820
  • 20
  • 127
  • 125
2

For your third question, Python Equivalent to phpinfo()

Community
  • 1
  • 1
Ankit Jaiswal
  • 22,859
  • 5
  • 41
  • 64