Python 如何知道我使用的是哪个 Django 版本?是 1.0、1.1 还是 1.2?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4151788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 14:29:53  来源:igfitidea点击:

How to know what django version i use? is it 1.0, 1.1, or 1.2?

pythondjango

提问by justjoe

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 ?

这是我第一次使用 django。我真的是个初学者。这是我第一次看到页面“它有效!祝贺你的第一个由 Django 驱动的页面。”。这意味着我现在在我的 xampp 服务器中有一个 django+python。所以我来回答这个问题?

  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 ?
  1. 如何知道我使用的是哪个 Django 版本?是 1.0、1.1 还是 1.2?
  2. 我在哪里可以在我的 django 文件夹(文件名)中读取它,以及如何使用代码/函数来打印 django 版本?
  3. python中有phpinfo()的替代品吗?

采纳答案by jcomeau_ictx

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'

回答by soulseekah

import django
django.VERSION

回答by aaronasterling

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 sysmodule:

有关其他信息,您可以使用该sys模块:

import sys

sys.version # Python version
sys.platform # platform

回答by Ankit Jaiswal

For your third question, Python Equivalent to phpinfo()

对于你的第三个问题,Python Equivalent to phpinfo()

回答by Octo

python manage.py runserver

Output:

输出:

Validating models...

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

正在验证模型...

0 错误发现 2015 年 2 月 27 日 - 14:25:41 Django version 1.6.5,使用设置......