Skip to content

Conversation

@rodrigobnogueira
Copy link

@rodrigobnogueira rodrigobnogueira commented Dec 29, 2025

Fixes #1328

  • Add None as default value in axes_conf_check
  • Add test coverage for missing settings scenario

What does this PR do?

Problem

The axes_conf_check function accessed settings without a default value, causing AttributeError when optional settings like AXES_CLIENT_STR_CALLABLE, AXES_USERNAME_CALLABLE, etc. were not explicitly defined in settings.py.

Solution

Added None as the default value to getattr(settings, callable_setting, None) in the axes_conf_check function. This aligns with the defaults defined in axes/conf.py and prevents the check from failing on undefined optional settings.

Changes

  • axes/checks.py: Added default value to getattr on line 210
  • tests/test_checks.py: Added test_missing_settings_no_error to verify fix

Fixes #1328 - AttributeError when starting Django server with django-axes installed but without explicitly defining all optional settings.

Checks

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Fixes jazzband#1328
- Add None as default value in axes_conf_check
- Add test coverage for missing settings scenario
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: When a setting is not added to settings.py, no default is used and error is raised on startup or during usage

1 participant