Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Put `NUM_PROXIES` setting in correct location for DRF (#3398)

sarayourfriendf96a1ae92033
diff --git a/api/conf/settings/rest_framework.py b/api/conf/settings/rest_framework.py
index 17f305043..b176beefc 100644
--- a/api/conf/settings/rest_framework.py
+++ b/api/conf/settings/rest_framework.py
@@ -48,6 +48,9 @@ REST_FRAMEWORK = {
},
"EXCEPTION_HANDLER": "api.utils.exceptions.exception_handler",
"DEFAULT_SCHEMA_CLASS": "api.docs.base_docs.MediaSchema",
+ # https://www.django-rest-framework.org/api-guide/throttling/#how-clients-are-identified
+ # Live environments should configure this to an appropriate number
+ "NUM_PROXIES": config("NUM_PROXIES", default=0, cast=int),
}
if config("DISABLE_GLOBAL_THROTTLING", default=True, cast=bool):
@@ -57,7 +60,3 @@ if config("DISABLE_GLOBAL_THROTTLING", default=True, cast=bool):
**{k: None for k, _ in REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"].items()}
)
del REST_FRAMEWORK["DEFAULT_THROTTLE_CLASSES"]
-
-# https://www.django-rest-framework.org/api-guide/throttling/#how-clients-are-identified
-# We override this in live environments to an appropriate number based on our deployment
-NUM_PROXIES = config("NUM_PROXIES", default=0, cast=int)