django-dbindexer error: name must be an instance of basestring
I'm using Django-nonrel from All Buttons Pressed, and trying to imple开发者_Go百科ment django-dbindexer. I can connect to MongoDB, create, update and delete documents.
However, when I tried implementing django-dbindexer, I get the following exception:
Caught ImproperlyConfigured while rendering: name must be an instance of basestring
Here's my model, settings and dbindexes:
#settings.py
DATABASES = {
'default': {
'ENGINE': 'django_mongodb_engine',
'NAME': 'test',
'USER': '',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': 27017,
}
}
DATABASES['native'] = DATABASES['default']
DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': 'native'}
AUTOLOAD_SITECONF = 'dbindexes'
MIDDLWARE_CLASSES = (
'autoload.middleware.AutoloadMiddleware',
...
)
INSTALLED_APPS = (
...
'blog',
'autoload',
'dbindexer',
)
#blog/models.py
from django.db import models
from djangotoolbox.fields import ListField
class Post(models.Model):
title = models.CharField(max_length=100)
text = models.TextField()
tags = ListField(blank=True)
comments = ListField(blank=True)
def __unicode__(self):
return self.title
#base dbindexes.py
from dbindexer import autodiscover
autodiscover()
#blog/dbindexes.py
from blog.models import Post
from dbindexer.api import register_index
register_index(Post, {'title' : 'iexact'})
Can anyone see what I'm doing wrong? Many thanks in advance!
[Update] Here's the full traceback: http://pastie.org/2346423
精彩评论