Get the version of Django for application

后端 未结 6 1673
感动是毒
感动是毒 2021-02-18 22:33

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 kno

6条回答
  •  花落未央
    2021-02-18 23:13

    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

提交回复
热议问题