Haystack may be used in dev mode if we have an ElasticSearch URL

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-01-16 22:36:25 +01:00
parent c5a8581a80
commit 7919b34d2b
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 6 additions and 15 deletions

View File

@ -24,7 +24,6 @@ PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
ADMINS = [("Emmy D'Anello", "emmy.danello@animath.fr")]
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
@ -38,7 +37,6 @@ SITE_ID = 1
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
@ -122,7 +120,6 @@ FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'
ASGI_APPLICATION = 'tfjm.asgi.application'
WSGI_APPLICATION = 'tfjm.wsgi.application'
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
@ -178,7 +175,6 @@ USE_TZ = True
LOCALE_PATHS = [os.path.join(BASE_DIR, "locale")]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
@ -203,7 +199,10 @@ DJANGO_TABLES2_TEMPLATE = 'django_tables2/bootstrap5.html'
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
'ENGINE': 'haystack.backends.elasticsearch7_backend.Elasticsearch7SearchEngine'
if os.getenv("HAYSTACK_INDEX_NAME", None) else 'haystack.backends.simple_backend.SimpleEngine',
'URL': 'http://elasticsearch:9200/',
'INDEX_NAME': os.getenv('HAYSTACK_INDEX_NAME', 'inscription-tfjm'),
}
}

View File

@ -38,12 +38,4 @@ CHANNEL_LAYERS = {
},
}
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch7_backend.Elasticsearch7SearchEngine',
'URL': 'http://elasticsearch:9200/',
'INDEX_NAME': os.getenv('HAYSTACK_INDEX_NAME', 'inscription-tfjm'),
}
}
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'