Skip to content
A django application to IP ban
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
django_ban
media
.gitignore
LICENSE.txt
MANIFEST.in
README.md
requirements.txt
setup.py

README.md

Django Ban

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.

MIT License releases last-commit Codacy Badge

🚀 Installation

Before

  • pip install djangoip==0.0.2
  • pip install django-ban==0.1.0
After

/settings.py

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 DEFAULT_CONFIG settings.

python manage.py makemigrations djangoip
python manage.py migrate

🤝 Contributing

Contributions, issues and feature requests are welcome.
Feel free to check issues page if you want to contribute.

Contributors

No contributors.

Author

👤 Hakan Çelik

📝 License

Copyright © 2019 Hakan Çelik.
This project is MIT licensed.

You can’t perform that action at this time.