diff --git a/tfjm/settings.py b/tfjm/settings.py index 24ccf7b..baabd14 100644 --- a/tfjm/settings.py +++ b/tfjm/settings.py @@ -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'), } } @@ -274,6 +273,6 @@ CHANNEL_LAYERS = { } if os.getenv("TFJM_STAGE", "dev") == "prod": # pragma: no cover - from .settings_prod import * # noqa: F401,F403 + from .settings_prod import * # noqa: F401,F403 else: - from .settings_dev import * # noqa: F401,F403 + from .settings_dev import * # noqa: F401,F403 diff --git a/tfjm/settings_prod.py b/tfjm/settings_prod.py index 198b2c4..1ef023f 100644 --- a/tfjm/settings_prod.py +++ b/tfjm/settings_prod.py @@ -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'