0

我有一个在 Ubuntu 12.10 上使用 Python 2.7.3 的 Django 1.4.3 项目。在我的整个项目中,只有一个settings.py文件,而在manage.py中,我有这一行

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hellodjango.settings")

当然,我的项目名称是 hellodjango,settings.py 文件在子文件夹 hellodjango 中(它们具有相同的名称)。

当我在控制台中键入以下行时:

python manage.py diffsettings

这些是我对数据库的结果:

DATABASES = {'default': {}, 'mioa': {'1': 'this thingy', '2': 'that thingy'}}

settings.py 中的相关行如下:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'mydatabase'
    },
    'mioa': {
        '1': 'this thingy',
        '2': 'that thingy'
    }
}

我在那里有“mioa”条目来证明我的问题。出于某种原因,未设置“默认”字段。有谁知道为什么会这样?或者解决方案是什么?

4

1 回答 1

0

帮助diffsettings说:

Displays differences between the current settings.py and Django's
default settings

这意味着,它只显示您的值和默认值之间的差异。似乎您的值与默认值完全相同,因此您看不到任何区别。

尝试另一个引擎和/或数据库名称,您会看到它已更改。

于 2013-02-11T09:59:04.663 回答