From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 21 Apr 2025 18:24:08 +0000 (-0700) Subject: Fix: include subpath in drf-spectacular settings if set (#9738) X-Git-Tag: v2.16.0~2^2~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f98c4b79491aea52d04011e2deca123ea89a974;p=thirdparty%2Fpaperless-ngx.git Fix: include subpath in drf-spectacular settings if set (#9738) --- diff --git a/src/paperless/settings.py b/src/paperless/settings.py index 743151ef1..6199bc632 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -350,23 +350,6 @@ REST_FRAMEWORK = { "DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema", } -# DRF Spectacular settings -SPECTACULAR_SETTINGS = { - "TITLE": "Paperless-ngx REST API", - "DESCRIPTION": "OpenAPI Spec for Paperless-ngx", - "VERSION": "6.0.0", - "SERVE_INCLUDE_SCHEMA": False, - "SWAGGER_UI_DIST": "SIDECAR", - "COMPONENT_SPLIT_REQUEST": True, - "EXTERNAL_DOCS": { - "description": "Paperless-ngx API Documentation", - "url": "https://docs.paperless-ngx.com/api/", - }, - "ENUM_NAME_OVERRIDES": { - "MatchingAlgorithm": "documents.models.MatchingModel.MATCHING_ALGORITHMS", - }, -} - if DEBUG: REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"].append( "paperless.auth.AngularApiAuthenticationOverride", @@ -410,6 +393,24 @@ FORCE_SCRIPT_NAME, BASE_URL, LOGIN_URL, LOGIN_REDIRECT_URL, LOGOUT_REDIRECT_URL _parse_base_paths() ) +# DRF Spectacular settings +SPECTACULAR_SETTINGS = { + "TITLE": "Paperless-ngx REST API", + "DESCRIPTION": "OpenAPI Spec for Paperless-ngx", + "VERSION": "6.0.0", + "SERVE_INCLUDE_SCHEMA": False, + "SWAGGER_UI_DIST": "SIDECAR", + "COMPONENT_SPLIT_REQUEST": True, + "EXTERNAL_DOCS": { + "description": "Paperless-ngx API Documentation", + "url": "https://docs.paperless-ngx.com/api/", + }, + "ENUM_NAME_OVERRIDES": { + "MatchingAlgorithm": "documents.models.MatchingModel.MATCHING_ALGORITHMS", + }, + "SCHEMA_PATH_PREFIX_INSERT": FORCE_SCRIPT_NAME or "", +} + WSGI_APPLICATION = "paperless.wsgi.application" ASGI_APPLICATION = "paperless.asgi.application"