django非依赖/管理App Engine上的每个字段索引

时间:2011-04-28 09:58:39

标签: python django django-nonrel

我正在尝试将我的gae webapp项目移动到django non-rel。我是Python和Django(非rel)的新手。现在我正在设置管理员后端。

当我想查看模型条目的历史时,我遇到了这个问题:

Caught DatabaseError while rendering: TextField is not indexed, 
by default, so you can't filter on it. Please add an index definition
for the column object_id on the model django.contrib.admin.models.LogEntry
as described here: http://www.allbuttonspressed.com/blog/django/2010/07/Managing-per-field-indexes-on-App-Engine

我遵循了赠送网站上的建议,但问题仍然存在。

我的gae_models_settings.py看起来像这样:

from maps.models import Poll, Choice
from django.contrib.admin.models import LogEntry

FIELD_INDEXES = {
    Poll: {'indexed': ['question']},
    Choice: {'indexed': ['choice']},
    LogEntry: {'indexed': ['object_id']},

}

在我的settings.py中,我添加了:

GAE_SETTINGS_MODULE = (
    'maps.gae_models_settings',
)

我哪里出错了?

2 个答案:

答案 0 :(得分:2)

GAE_SETTINGS_MODULE”中缺少一封信。

正确的版本是:

GAE_SETTINGS_MODULES = (
    'maps.gae_models_settings',
)

答案 1 :(得分:2)

如果你将ae_models_settings.py放在与settings.py相同的级别,我认为它应该是:

GAE_SETTINGS_MODULES = (
'gae_models_settings',
)

适合我。