Skip to content
Advertisement

Django-axes Errors: ‘Settings’ object has no attribute . .

I’ve run into a lot of attribute errors when using django-axes. Whenever I fix one of them by setting the default attributes, more start showing up. I followed the documentation for installation. Here is my code…

settings.py

JavaScript

At the bottom I tried to set some of the default attributes that were causing errors. Right now, the code above results in a 'Settings' object has no attribute 'AXES_HANDLER' error.

In views.py when authenticating the user I have set request=request as the documentation said. I’ve also added a lockout function:

JavaScript

Note: I am also using a custom user model so users can log in with their email. I tested it on a different project with django-axes and everything was working well. So I don’t think that’s the issue here.

Question: How do I fix this? Is there anything I need to install or configure differently?

Advertisement

Answer

Currently I am also using django-axes for custom views.py login page. What I did was to include decorator @axes_dispatch on my login function. For Settings.py, ensure that AXES_USERNAME_FORM_FIELD is configured to your user credential field. For mine, im using ’email’. So its should be changed to AXES_USERNAME_FORM_FIELD='email'.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement