Django 1.10が提供するPostgresの全文検索を使用し、NotImplementedErrorを取得しています。私が使用している検索クエリがある:Django 1.10でPostgres検索を使用するとNotImplementedErrorが発生する1.10
Application.objects.filter(applicant_data__search='test')
エラーは次のとおりです。
NotImplementedError: Add 'django.contrib.postgres' to settings.INSTALLED_APPS to use the search operator.
マイINSTALLED_APPS設定は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',
]
私はpsycopg2を使用しています私のdbエンジン:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dbname',
'USER': 'username',
'PASSWORD': '',
'HOST': 'localhost',
}
}
私のモデルは次のとおりです。
class Application(models.Model):
applicant_data = JSONField()
私はDjangoのシェルからget_app_configを実行すると、Postgresのアプリに戻り、正しい値:
from django.apps import apps
apps.get_app_config('postgres').name
'django.contrib.postgres'
NotImplementedErrorを投げる機能がdjango.db.backendsからfulltext_search_sqlです。私の推測では、django.contrib.postgresは正しくロードされていないか、またはデフォルトのdjango postgresバックエンドに置き換えられています。
ここからどこに行くべきか分かりませんが、誰も同じような問題や洞察を持っていますか?
これはまだ問題ですか? – najeeb