Skip to main content

Django middleware for blocking IPs listed in

Project description

A django application that provides middleware for blocking IPs listed in’s database.

A management command is provided for updating the database: sfsupdate [–force]

…and all IPs are stored in Django models so you can add your own as well (remember to mark them permanent so they don’t get deleted!)


At the moment there is no updated packages, so install directly from github using:

pip install git+git://

The old release was installed by running:

sudo pip install stopforumspam

Add this to settings.MIDDLEWARE_CLASSES


Then add this to INSTALLED_APPS


And run

./ syncdb

To insert all the IPs run this command, which you should make a cronjob (run it every 24h).

./ sfsupdate

You may remove stopforumspam from your INSTALLED_APPS after, if you do not wish to see it in your admin pages.


The following options exist for your project’s file:

To check ALL POST requests:


To ignore some URLS:

SFS_URLS_IGNORE = [“url_name”, “/url/path”]

To only include some URLS (only works if SFS_ALL_POST_REQUEST=False):

SFS_URLS_INCLUDE = [“url_name”, “/url/path”]

To configure where to download the file from (you can MAX download 2 times a day) - see for more resources:


Remember to configure this as well – it’s the name of the file inside the .zip file:

SFS_ZIP_FILENAME = “listed_ip_7.txt”

For testing you can force all requests to be checked.


Cron Jobs

You probably want to automatically update the list of blocked IP addresses every 24 hours or 48 hours. To do that, you can insert a line in crontab.

0 2 * * * cd /your/project/path/ && python sfsupdate

The above would update at 2 AM every night.

Project details

Release history Release notifications

History Node


History Node


History Node


History Node


History Node


History Node


History Node


This version
History Node


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
stopforumspam-1.1.tar.gz (5.4 kB) Copy SHA256 hash SHA256 Source None Sep 5, 2012

Supported by

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