A django application to ip ban.
If the number of requests from an IP address is too high, that IP is banned, You can set the IP ban in settings file.
pip install djangoip==0.0.2
pip install django-ban==0.1.0
INSTALLED_APPS += ["djangoip", "django_ban"] MIDDLEWARE = [ # should be added to the top. "djangoip.middleware.ip_middleware.IpMiddleware", "django_ban.middleware.ip.IPBanMiddleware", ...... ] # default ip ban conf DJANGO_BAN_CONFIGS = dict( remove_ban_time=60, permission_second=1, permission_request_count=10, )
remove_ban_time After how many second, ban removed
permission_second How long the IP can throw requests for the number of 'permission_request_count'.
permission_request_count Permission request count
All values must be given in seconds, these settings apply to all addresses in your project and you can change your settings for the desired URL from the URL settings later.
for example, you can change a maximum of 6 requests per 1 second to your login page.
The specific page settings that you subsequently update do not change even if you change the
python manage.py makemigrations djangoip python manage.py migrate
Contributions, issues and feature requests are welcome.
Feel free to check issues page if you want to contribute.