Good night, welcome back again in Python Learning, this time i wanna share simply tutorial how to Install Django Recaptcha from Google reCAPTCHA.

There is using Django reCAPTCHA, for more you can checkout at this repository https://github.com/praekelt/django-recaptcha

  1. Makesure you already has the form before setup Django reCAPTCHA.
  2. Installing django from pip: $ pip install django-recaptcha or directly from branch.
  3. Add captcha to your INSTALLED_APPS on settings.py
  1. Put some keys from Google reCAPTCHA, for example like this in you settings.py
RECAPTCHA_PUBLIC_KEY = '76wtgdfsjhsydt7r5FFGFhgsdfytd656sad75fgh'
RECAPTCHA_PRIVATE_KEY = '98dfg6df7g56df6gdfgdfg65JHJH656565GFGFGs'

5. Usage Django reCAPTCHA for example like this in your forms.py

from django import forms
from member.models import Member
from captcha.fields import ReCaptchaField

class RegisterForm(forms.ModelForm):
    captcha = ReCaptchaField(attrs={'theme' : 'clean'})

    class Meta:
        model = Member
        fields = ['username', 'email', 'password']

Thereis basiclly how to install and usage your Django reCAPTCHA, and will automatically manage error response or success response. Simply right? laugh

for more usage, you can checkout on this repository: https://github.com/praekelt/django-recaptcha

module python django

Your Answer

blog comments powered by Disqus