From 678f240cd343352bd98c08093b1052c99b3412c7 Mon Sep 17 00:00:00 2001 From: Erwan Rouchet <rouchet@teklia.com> Date: Tue, 22 Oct 2024 17:50:43 +0200 Subject: [PATCH] Use the WSGI_APPLICATION setting when running Gunicorn --- arkindex/documents/management/commands/gunicorn.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arkindex/documents/management/commands/gunicorn.py b/arkindex/documents/management/commands/gunicorn.py index accebace27..bbf44a441d 100644 --- a/arkindex/documents/management/commands/gunicorn.py +++ b/arkindex/documents/management/commands/gunicorn.py @@ -4,7 +4,7 @@ import sys from django.conf import settings from django.core.management.base import BaseCommand, CommandError -from django.core.wsgi import get_wsgi_application +from django.core.servers.basehttp import get_internal_wsgi_application class Command(BaseCommand): @@ -67,6 +67,9 @@ class Command(BaseCommand): } def load(self): - return get_wsgi_application() + # Django's get_wsgi_application returns only its default WSGI app, + # but we want to use whatever app is set with the WSGI_APPLICATION setting, + # which is returned by get_internal_wsgi_application. + return get_internal_wsgi_application() ArkindexServer().run() -- GitLab