3

I can't believe this hasn't been asking on here before. Besides using a syntax error to make the debug screen appear in the browser, is there another way to check which version of Python a Django site is running?

4
  • In what way? Are you hosting the site? Commented Jan 25, 2015 at 21:28
  • Yes, I have it on a linux box. I have Python 2.6.6 and Python 2.7.9 installed and just want to confirm it's using the Python in my virtual env as last time it was not. Commented Jan 25, 2015 at 21:29
  • You could install the Django debug toolbar which displays the Python version in use. Commented Jan 25, 2015 at 21:31
  • 1
    import sys; print(sys.version) will work for just about any version, including the two you mentioned. Commented Jan 25, 2015 at 21:33

1 Answer 1

2

Not that different from checking Python version from any Python program, https://docs.python.org/2/library/platform.html#platform.python_version

>>> from platform import python_version
>>> python_version()     # Read this value from e.g. a Django command, or a page 
'2.7.6'

# Or
>>> import sys
>>> sys.version_info   
sys.version_info(major=2, minor=7, micro=6, releaselevel='final', serial=0)
Sign up to request clarification or add additional context in comments.

1 Comment

So you're suggesting to put it into my code temporarily?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.