I'm using the full text search for Postgres offered by Django 1.10 and getting a NotImplementedError. The search query I'm using is:
Application.objects.filter(applicant_data__search='test')
The error is:
NotImplementedError: Add 'django.contrib.postgres' to settings.INSTALLED_APPS to use the search operator.
My INSTALLED_APPS setting includes django.contrib.postgres:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.postgres',
'main',
]
I'm using psycopg2 for my db engine:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dbname',
'USER': 'username',
'PASSWORD': '',
'HOST': 'localhost',
}
}
My model is:
class Application(models.Model):
applicant_data = JSONField()
When I run get_app_config from the django shell, the postgres app returns correct values:
from django.apps import apps
apps.get_app_config('postgres').name
'django.contrib.postgres'
The function throwing the NotImplementedError is the fulltext_search_sql from django.db.backends.postgres, so my guess is that django.contrib.postgres is either not being loaded correctly or is being replaced by the default django postgres backend.
Not sure where to go from here, anyone have a similar issue and/or insights?