我有一个在 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”条目来证明我的问题。出于某种原因,未设置“默认”字段。有谁知道为什么会这样?或者解决方案是什么?