Skip to content

geneos/django-rest-framework-recaptcha

 
 

Repository files navigation

Django REST framework reCAPTCHA

image

image

image

Documentation Status

Django REST framework reCAPTCHA provides you a serializer field to handle and validate Google reCAPTCHA response.

Documentation

The full documentation is at https://django-rest-framework-recaptcha.readthedocs.io.

Requirements

  • Python: 2.7, 3.4, 3.5, 3.6, 3.7
  • Django: 1.10, 1.11, 2.0, 2.1
  • Django REST framework: 3.4, 3.5, 3.6, 3.7, 3.8, 3.9

Installation

To install Django REST framework reCAPTCHA, run this command in your terminal:

$ pip install djangorestframework-recaptcha

This is the preferred method to install Django REST framework reCAPTCHA, as it will always install the most recent stable release.

If you don't have pip installed, this Python installation guide can guide you through the process.

Once the djangorestframework-recaptcha installed, add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    "rest_framework_recaptcha",
    ...
)

Next, register yourself and obtain your reCAPTCHA credentials at https://www.google.com/recaptcha/admin.

Finally, copy/paste your Google reCAPTCHA secret key to the DRF_RECAPTCHA_SECRET_KEY setting:

DRF_RECAPTCHA_SECRET_KEY = "<your_reCAPTCHA_secret_key>"

Usage

To use Django REST framework reCAPTCHA within your project you'll need to import and add the ReCaptchaField serializer field into the wanted serializer. For example:

from rest_framework import serializers
from rest_framework_recaptcha import ReCaptchaField


class MySerializer(serializers.Serializer):
    recaptcha = ReCaptchaField()

About

reCAPTCHA field for Django REST framework serializers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 84.9%
  • Makefile 13.7%
  • Dockerfile 1.4%