Skip to main content

Simple captha for django-rest-framework

Project description

# Django rest capthca

This is lightweight version of django-simple-captcha for work with
django-rest-framework.


## Features
- speed: use cache insted database
- safety: union methods for generate key and image. (You can't generate many images for one key)
- easy: only one rest api (for generate, refresh image).


## Install
```
> pip install django-rest-captcha
```

## Add to project

Add to installed apps
```
INSTALLED_APPS = (
...
'rest_framework',
)
```

Set rest_captcha serrings (if you want):
```
REST_CAPTCHA = {
'CAPTCHA_CACHE': 'default',
'CAPTCHA_TIMEOUT': 300, # 5 minuts
'CAPTCHA_LENGTH': 4,
'CAPTCHA_FONT_SIZE': 22,
'CAPTCHA_IMAGE_SIZE': (90, 40),
'CAPTCHA_LETTER_ROTATION': (-35, 35),
'CAPTCHA_FOREGROUND_COLOR': '#001100',
'CAPTCHA_BACKGROUND_COLOR': '#ffffff',
'CAPTCHA_FONT_PATH': FONT_PATH,
'CAPTCHA_CACHE_KEY': 'rest_captcha_{key}.{version}',
'FILTER_FUNCTION': 'rest_captcha.captcha.filter_default',
'NOISE_FUNCTION': 'rest_captcha.captcha.noise_default'
}
```

We recommendete use radis or lacal memory as cache with set parameter, with bigger value of MAX_ENTRIES:
```
CACHES={
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'rest-captcha',
'MAX_ENTRIES': 10000,
}
}
```

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-rest-captcha-0.0.4.tar.gz (52.6 kB view details)

Uploaded Source

File details

Details for the file django-rest-captcha-0.0.4.tar.gz.

File metadata

File hashes

Hashes for django-rest-captcha-0.0.4.tar.gz
Algorithm Hash digest
SHA256 b0443d537c9e0b493388acea762927c9bfd916c3c46c17a6b39625128189cbd7
MD5 9db7fa53cc6cf9d779cdf6683e49656d
BLAKE2b-256 62efa844006dffb1ad41445e17512b9ad36bc4ff950b6cc771be95dcb0ee576e

See more details on using hashes here.

Supported by

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