Menu

Tree [5cd2f1] default tip /
 History

Read Only access


File Date Author Commit
 axes 2009-12-17 codekoala codekoala [356c6a] GC #1 - I've implemented some of the groovy fea...
 dist 2008-12-06 wheaties.box wheaties.box [9f2df5] Created tag 0.1.1-rc1
 .hgignore 2009-12-17 codekoala codekoala [251184] Added an ignores file
 LICENSE 2009-12-17 codekoala codekoala [356c6a] GC #1 - I've implemented some of the groovy fea...
 MANIFEST 2008-11-05 wheaties.box wheaties.box [7cdde7] Initial import
 MANIFEST.in 2008-11-05 wheaties.box wheaties.box [7cdde7] Initial import
 README 2009-12-17 codekoala codekoala [5cd2f1] Updated the README with info for hg and git
 setup.py 2008-12-06 wheaties.box wheaties.box [9f2df5] Created tag 0.1.1-rc1

Read Me

django-axes is a very simple way for you to keep track of failed login attempts, both for the Django admin and for the rest of your site.  The name is sort of a geeky pun, since `axes` can be read interpretted as:

  # "access", as in monitoring access attempts
  # "axes", as in tools you can use hack (generally on wood).  In this case, however, the "hacking" part of it can be taken a bit further: `django-axes` is intended to help you *stop* people from hacking (popular media definition) your website.  Hilarious, right?  That's what I thought too!

==Requirements==

`django-axes` requires Django 1.0 or later.  The application is intended to work around the Django admin and the regular `django.contrib.auth` login-powered pages.

==Installation==

Download `django-axes` using *one* of the following methods:

===easy_install===

You can download the package from the [http://pypi.python.org/pypi/django-axes/ CheeseShop] or use

{{{
easy_install django-axes
}}}

to download and install `django-axes`.

===Package Download===

Download the latest `.tar.gz` file from the downloads section and extract it somewhere you'll remember.  Use `python setup.py install` to install it.

===Checkout from Mercurial===

Execute the following command (or use the equivalent function in a GUI such as TortoiseHg), and make sure you're checking `django-axes` out somewhere on the `PYTHONPATH`.

{{{
hg clone http://django-axes.googlecode.com/hg django-axes
hg clone http://bitbucket.org/codekoala/django-axes
}}}

===Checkout from GitHub===

Execute the following command, and make sure you're checking `django-axes` out somewhere on the `PYTHONPATH`.

{{{
git clone git://github.com/codekoala/django-axes.git
}}}

===Verifying Installation===

The easiest way to ensure that you have successfully installed `django-axes` is to execute a command such as:

{{{
python -c "import axes; print axes.get_version()"
}}}

If that command completes with some sort of version number, you're probably good to go.  If you see error outout, you need to check your installation (I'd start with your `PYTHONPATH`).

==Configuration==

First of all, you must add this project to your list of `INSTALLED_APPS` in `settings.py`:

{{{
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    ...
    'axes',
    ...
)
}}}

Next, install the `FailedLoginMiddleware` middleware:

{{{
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'axes.middleware.FailedLoginMiddleware'
)
}}}

Run `manage.py syncdb`.  This creates the appropriate tables in your database that are necessary for operation.

===Customizing Axes===

You have a couple options available to you to customize `django-axes` a bit.  These should be defined in your `settings.py` file.

  * `AXES_LOGIN_FAILURE_LIMIT`: The number of login attempts allowed before a record is created for the failed logins.  Default: `3`
  * `AXES_LOCK_OUT_AT_FAILURE`: After the number of allowed login attempts are exceeded, should we lock out this IP (and optional user agent)?  Default: `True`
  * `AXES_USE_USER_AGENT`: If True, lock out / log based on an IP address AND a user agent.  This means requests from different user agents but from the same IP are treated differently.  Default: `False`

==Usage==

Using `django-axes` is extremely simple.  Once you install the application and the middleware, all you need to do is periodically check the Access Attempts section of the admin.  A log file is also created for you to keep track of the events surrounding failed login attempts.  This log file can be found in your Django project directory, by the name of `axes.log`.  In the future I plan on offering a way to customize options for logging a bit more.

By default, django-axes will lock out repeated attempts from the same IP address.  You can allow this IP to attempt again by deleting the relevant AccessAttempt records in the admin.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.