Skip to content
inueni edited this page Sep 13, 2010 · 2 revisions

Settings

This go into your project settings.py file:

CAPTCHA_IMAGES_PATH
bq. Absolute path to location that will hold generated CAPTCHA images. Make sure to use a trailing slash.

CAPTCHA_IMAGES_URL
bq. URL that points to location of stored CAPTCHA images. Make sure to use a trailing slash.

CAPTCHA_FONT
bq. TrueType font used for rendering letter and numbers on CAPTCHA images.

CAPTCHA_BASE_IMAGE
bq. Image to be used as background for generated CAPTCHA images.

Default background image and selection of DejaVu fonts are included in the package.

Usage

Make sure all of the above settings are specified and that CAPTCHA_IMAGES_PATH is writable by your application.
Add captcha module to your project or somewhere on python.path.

from django import forms
from captcha.fields import CaptchaField

class MyForm(forms.Form):
        captcha = CaptchaField('Are you human?')

And that is it, it’s that simple.

Clone this wiki locally