Skip to main content

Simple spam blocker for Django

Project description

https://secure.travis-ci.org/moqada/django-simple-spam-blocker.png?branch=master

Django Simple Spam Blocker is blocking spam by regular expression.

Filtering the following matters.

  • Author

  • Content

  • Email

  • IP

  • Referer

  • URL

  • UserAgent

And you can edit regular expression, on Django’s admin site.

Installation

  1. Add the simplespamblocker directory to your Python path.

  2. Add simplespamblocker to your INSTALLED_APPS.:

    INSTALLED_APPS = (
        # ...
        'simplespamblocker',
        # ...
    )
  3. Add the following middleware to your MIDDLEWARE_CLASSES.:

    MIDDLEWARE_CLASSES = (
        # ...
        'simplespamblocker.middleware.SpamBlockMiddleware',
        # ...
    )
  4. Add path which you wanto to block spam to SIMPLESPAMBLOCKER_PROFILES on settings.py.:

    SIMPLESPAMBLOCKER_PROFILES = (
        # Sample for django's comment framework
        (r'^/comments/post/$', {
            'method': 'post',
            'author': lambda request: request.POST.get('name', ''),
            'email': lambda request: request.POST.get('email', ''),
            'url': lambda request: request.POST.get('url', ''),
            'content': lambda request: request.POST.get('comment', ''),
        }),
    )
  5. Run syncdb.:

    $ python manage.py syncdb

    Note: When your project use South, run the following command.:

    $ python manage.py migrate simplespamblocker
  6. Run your server, visit admin site and edit regular expression of Option model.

Settings

SIMPLESPAMBLOCKER_PROFILES

The list of tuple – regular expression of path and block profile –.

SIMPLESPAMBLOCKER_SPAM_TEMPLATE

A path of template file which is rendering after blocking spam This key is generated per Option model.

default: ‘simplespamblocker/option/<id>’

SIMPLESPAMBLOCKER_LOGGER_NAME

Python’s builtin logger name. This logger logs at blocking spam. Default value is None. (inactive)

Others

This project is Inspired by django-spaminspector.

Project details


Download files

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

Source Distribution

django-simple-spam-blocker-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

File details

Details for the file django-simple-spam-blocker-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django-simple-spam-blocker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 81ee20000bd231614fa0cf7a7db36b861b2210539f5ebfe72f6e81008c95085b
MD5 11dcce9d9956b158af33e0696b082878
BLAKE2b-256 23a5ef0e644152429d7be068a255668ed7607d30b7507404b4eb22dd96834c89

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page