Skip to main content

Custom model backend for blocking users and ip after several attempts to access wrongly

Project description

Custom model backend for blocking users and ip after several attempts to access wrongly


  1. Install django-blockmodelbackend:

    pip install django-blockmodelbackend
  2. Add blockmodelbackend to your INSTALLED_APPS settings:

  3. Run the makemigrations and migrate commands:

    python makemigrations blockmodelbackend
    python migrate
  4. Add the new backend class to your AUTHENTICATION_BACKENDS settings:



There is some parameters to customize the backend.

. MAX_ACCESS_ATTEMPTS:[ 3 ] maximum numbers of wrong authentication attempts before blocking

. LOCK_DURATION:[ 5 ] lock duration in minutes

. DELTA_LOCK_DURATION:[ 1 ] increase in the lock duration in minutes

. USER_PERMANENT_BLOCK:[ False ] boolean value

. IP_PERMANENT_BLOCK:[ False ] boolean value

. BLOCK_TYPE:[ both ] choice between both, user or ip

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django_blockmodelbackend-0.2.1-py2.py3-none-any.whl (4.2 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Sep 9, 2018
django-blockmodelbackend-0.2.1.tar.gz (3.4 kB) Copy SHA256 hash SHA256 Source None Sep 9, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page