Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 查找旧项目的django版本号_Python_Django_Version - Fatal编程技术网

Python 查找旧项目的django版本号

Python 查找旧项目的django版本号,python,django,version,Python,Django,Version,我正在开始一个两年前有人开始的项目,我很难弄清楚它运行的是什么版本的django。制作这个项目的人不知道,我也不确定猜测和检查是否有效,因为我不知道这个项目是否编译。我已经找到了答案,但它表明该版本是1.0之前的版本,我真的不确定从那里走到哪里。除了猜测和检查外,有没有一种好的方法来判断版本是什么 我的settings.py是 import os PROJECT_PATH = os.path.abspath(os.path.dirname(__file__)) DEBUG = True TEM

我正在开始一个两年前有人开始的项目,我很难弄清楚它运行的是什么版本的django。制作这个项目的人不知道,我也不确定猜测和检查是否有效,因为我不知道这个项目是否编译。我已经找到了答案,但它表明该版本是1.0之前的版本,我真的不确定从那里走到哪里。除了猜测和检查外,有没有一种好的方法来判断版本是什么

我的settings.py是

import os
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', 'your_email@domain.com'),
)

MANAGERS = ADMINS

DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = os.path.join(PROJECT_PATH, 'site.db') # Or path to database file if using sqlite3.
DATABASE_USER = ''             # Not used with sqlite3.
DATABASE_PASSWORD = ''         # Not used with sqlite3.
DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/admin/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = some gibberish

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source',
#     'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
)

#ROOT_URLCONF = 'site.urls'
ROOT_URLCONF = 'project.urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'project.site',
)

#TD_SERVER_PORT = 'tcp:8080:interface=192.168.1.43'
#TD_BIN_DIR = '/Users/me/django/project/bin'
TD_WORK_DIR = '/Users/me/td_work'
TD_COMPACT_MODE = False
TD_MAX_UPLOAD_RATE = 20 * 1024
TD_MAX_DOWNLOAD_RATE = 80 * 1024
#TD_LISTEN_PORT_MIN = 59543
#TD_LISTEN_PORT_MAX = 59553
TD_LISTEN_PORT_MIN = 6881
TD_LISTEN_PORT_MAX = 6891

# Icecast stream upload settings.
TD_STREAM_NAME = '[o_o] site.net'
TD_STREAM_PORT = 8000
#TD_STREAM_HOST = 'thingie.com'
#TD_STREAM_PASSWORD = 'poiuyt'
TD_STREAM_HOST = 'localhost'
TD_STREAM_PASSWORD = 'qwerty'
#TD_STREAM_HOST = 'otherthingie.com'
#TD_STREAM_PASSWORD = 'wopwopwop'

# CD Ripper
TD_CD_DIR = '/home/me/td_work/cds'
我的manage.py是

#!/usr/bin/env python
from django.core.management import execute_manager
try:
    import settings # Assumed to be in the same directory.
except ImportError:
    import sys
    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
    sys.exit(1)

if __name__ == "__main__":
    execute_manager(settings)
我的URL.py是

from django.conf.urls.defaults import *
from project.site.models import Syndicator, Torrent

torrent = {
    'queryset': Torrent.objects.all(),
    'extra_context': {'syndicators': Syndicator.objects.all()},
}

torrents = {
    'queryset': Torrent.objects.all().order_by('-pub_date'),
    'paginate_by': 25,
    'allow_empty': True,
    'extra_context': {'syndicators': Syndicator.objects.all()},
}

urlpatterns = patterns('',
    (r'^$', 'django.views.generic.list_detail.object_list', torrents, 'home-page'),

    (r'^feeds/$', 'django.views.generic.list_detail.object_list', torrents, 'feed-list'),
    (r'^feeds/page(?P<page>[0-9]+)/$', 'django.views.generic.list_detail.object_list', torrents, 'feed-list-page'),
    (r'^feeds/post/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', torrent, 'feed-post'),
    (and a lot more patterns),
)
从django.conf.url.defaults导入*
从project.site.models导入辛迪加,Torrent
激流={
'queryset':Torrent.objects.all(),
'extra_context':{'Syndicator':Syndicator.objects.all()},
}
激流={
'queryset':Torrent.objects.all().order_by('-pub_date'),
“分页方式”:25,
“allow_empty”:True,
'extra_context':{'Syndicator':Syndicator.objects.all()},
}
urlpatterns=模式(“”,
(r“^$”、“django.views.generic.list_detail.object_list”、torrents、“主页”),
(r“^feeds/$”、“django.views.generic.list_detail.object_list”、torrents、“feed list”),
(r“^feeds/page(?P[0-9]+)/$”,“django.views.generic.list_detail.object_list”,torrents,“feed list page”),
(r“^feeds/post/(?P\d+/$”,“django.views.generic.list_detail.object_detail”,torrent,“feed post”),
(还有更多的模式),
)

我不确定这到底有什么关系。数据库设置意味着1.2之前的版本,因此1.1应该可以正常工作。Django很少破坏向后兼容性(database one是一个罕见的例外),因此点版本之间的差异不会有太大影响。

这告诉我我的机器运行的是什么版本,而不是项目的版本。嗯,没有简单的答案。我建议您查看(django和project)配置文件——在django开发过程中有很多更改。显示为示例URL、数据库声明等。这需要更多信息。显示您的
设置.py
管理.py
URL.py
。查看模型。模型是否在内部定义了
Admin
类?Django 1.4中删除了类似于
DATABASE\u NAME
的约定,因此让我们关注OD1.3及以下内容。是否有
admin.py
文件?在
urls.py
文件中定义了什么
admin.site.urls
模式?@pancakes是的,没有admin.py,字符串“admin”在urls.py文件中不出现
(virtualenv)~$ python

>>> import django
>>> print django.get_version()
'1.4.1'