Django captcha contact form
This project is an example to show how to combine contact forms and captcha protection in Django.
To not reinvent the wheel everytime, the project relies on Django contact form and Django Simple Captcha , which in turn requires Python Image Library to generate captcha images. Both the applications are well focused on their specific goals, but also flexible enough to be used together with interesting results.
To see captcha forms in action you need an internet connection, virtualenv and optionally mercurial. There are very good reasons to use virtualenv; if you don't yet use it consider to start now, you'll be rewarded.
Create a virtual environment and activate it:
$ virtualenv captcha_contact_form $ cd captcha_contact_form $ . bin/activate
If mercurial is installed get the project source:
$ hg clone ssh://firstname.lastname@example.org/pdina/django-captcha-contact-form project
If mercurial is not installed download and extract tarball files:
$ wget https://bitbucket.org/pdina/django-captcha-contact-form/get/tip.tar.gz $ tar xzf tip.tar.gz $ # rename the extracted directory to project, for example: $ mv pdina-django-captcha-contact-form-d72850994a9f project
Install the required packages:
$ pip install -r project/requirements.txt
Create the database and run the web server:
$ cd project $ python manage.py syncdb --no-input $ python manage.py runserver
Visit http://127.0.0.1:8000 and see the captcha form working.
The setting EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' prevents any mail to be really sent. Instead mails get written to standard out (the console running the development web server).