I have the issue using Django-ratelimit on heroku that the limiter is not working. I don't get any error. Any suggestions what I am doing wrong?
views.py
from django.core.cache import cache
from ratelimit.mixins import RatelimitMixin
[...]
class LoginView(RatelimitMixin, FormView):
ratelimit_key = 'user'
ratelimit_rate = '1/5m'
ratelimit_method = 'GET'
ratelimit_block = True
template_name = "account/login.html"
template_name_ajax = "account/ajax/login.html"
form_class = LoginUsernameForm
form_kwargs = {}
redirect_field_name = "next"
@method_decorator(sensitive_post_parameters())
@method_decorator(csrf_protect)
@method_decorator(never_cache)
def dispatch(self, *args, **kwargs):
return super(LoginView, self).dispatch(*args, **kwargs)
def get(self, *args, **kwargs):
if is_authenticated(self.request.user):
return redirect(self.get_success_url())
return super(LoginView, self).get(*args, **kwargs)
Setting.py
# RATELIMIT SETTINGS
#RATELIMIT_CACHE_PREFIX = 'rl:'
RATELIMIT_ENABLE = True
RATELIMIT_USE_CACHE = 'default'
#RATELIMIT_VIEW = None