获取Django的应用程序版本 [英] Get the version of Django for application

查看:132
本文介绍了获取Django的应用程序版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始一个新的(实际上很老的)项目,我知道的是Django。我失去了解它已经建立的Django的确切版本。有没有办法知道我的应用程序正在运行的Django的版本?

解决方案

唯一的方法是猜测。我将首先查看settings.py文件(或其他基础项目文件)的创建日期。



版本发布日期:




  • 1.0:2008年9月(?)

  • 1.1:2009年7月29日[ 1 ]

  • 1.2:2010年5月17日[ 2 ]

  • 1.3:2011年3月23日[ 3 ]



拥有您的urls.py:[ 4 ]

  from django.conf.urls.defaults import * 
from django.contrib import admin

或在应用程序中拥有一个 admin.py [ 5 ]建议它是一个1.0+的项目。



拥有在您的urls.py中:[ 6 ]

 (r'^ admin /',include(admin.site.urls)),

会建议1.1 +。



在您的设置中。 py文件:

  DATABASES = {
'default':{
'NAME':'app_data' ,
'ENGINE':'django.db.backends.postgresql_psycopg2',
'USER':'postgres_user',
'PASSWORD':'s3krit'
},
'users':{
'NAME':'user_data',
'ENGINE':'django.db.backends.mysql',
'USER':'mysql_user',
'PASSWORD':'priv4te '
}
}

会建议1.2 +。



[1]: 1.1发行说明



[2]: 1.2发行说明



[3]: 1.3发行说明



[4]:向后不兼容的更改0.96> 1.0



[5]:向后不兼容的更改0.96> 1.0



[ 6]:多个数据库


I am starting a new (actually very old) project which I know is in Django. I am getting lost knowing the exact version of Django it has been build upon. Is there a way I can know the version of Django my application is running?

解决方案

The only way is to take a guess. I would start by looking at the created date of the settings.py file (or other base project files)

Release dates for versions:

  • 1.0: September 2008. (?)
  • 1.1: July 29, 2009 [1]
  • 1.2: May 17, 2010 [2]
  • 1.3: March 23, 2011 [3]

Having in your urls.py:[4]

from django.conf.urls.defaults import *
from django.contrib import admin

or having an admin.py file in an application [5] suggests that it is a 1.0+ project.

Having in your urls.py: [6]

(r'^admin/', include(admin.site.urls)),

would suggest 1.1+.

Having in your settings.py file:

DATABASES = {
    'default': {
        'NAME': 'app_data',
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'USER': 'postgres_user',
        'PASSWORD': 's3krit'
    },
    'users': {
        'NAME': 'user_data',
        'ENGINE': 'django.db.backends.mysql',
        'USER': 'mysql_user',
        'PASSWORD': 'priv4te'
    }
}

would suggest 1.2+.

[1]: 1.1 release notes

[2]: 1.2 release notes

[3]: 1.3 release notes

[4]: Backwards Incompatible changes 0.96 > 1.0

[5]: Backwards Incompatible changes 0.96 > 1.0

[6]: Multiple databases

这篇关于获取Django的应用程序版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆