Django REST Framework: "No default throttle rate set for 'signup' scope" even though scope is defined
I’m trying to apply custom throttling for the signup endpoint in my Django REST Framework API.
The goal is to allow only 5 signup attempts per hour for anonymous users.
I created a SignupRateThrottle class that sets scope = "signup" and included it in DEFAULT_THROTTLE_CLASSES. I also added "signup": "5/hour" inside DEFAULT_THROTTLE_RATES in my settings.py.
However, when I make a request to /api/v1/auth/signup/, I get this error:
ImproperlyConfigured: No default throttle rate set for 'signup' scope
Even though I already set the throttle rate for signup in my settings.
I’ve double-checked that:
The spelling of "signup" matches everywhere.
Restarting the server doesn’t fix it.
The error happens on a GET request, but I only intended to throttle POST requests.
What I expected:
Throttling should only apply to POST requests. After 5 signups in an hour, DRF should return 429 Too Many Requests.
What happens instead:
I get the ImproperlyConfigured error immediately.
What I tried:
Added "signup": "5/hour" in REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"].
Restarted the server multiple times.
Verified that scope = "signup" matches in both the throttle class and settings.
Tried removing other custom throttles from DEFAULT_THROTTLE_CLASSES to isolate the issue