Skip to main content

django-cf-turnstile

django-cf-turnstile is a Django app for integrating Cloudflare Turnstile captchas into django forms.

Note that django-cf-turnstile only supports implicit rendering of widgets.

Requirements

  • Python: 3.10+
  • Django: 4.2+

Installation

Install the package with:

pip install django-cf-turnstile

Add "django_cf_turnstile" to your INSTALLED_APPS setting.

INSTALLED_APPS = [
   ...,
   "django_cf_turnstile",
]

Add your Turnstile site key and secret to your django settings.

# django-cf-turnstile
# Dummy keys used below, replace with your actual keys

CF_TURNSTILE_SITE_KEY = "1x00000000000000000000AA"
CF_TURNSTILE_SECRET_KEY = "1x0000000000000000000000000000000AA"

Note that if you don't provide a site key and secret key the test site keys which always pass validation will be used.

For more information on test keys see https://developers.cloudflare.com/turnstile/troubleshooting/testing/.

Usage

In your Django forms import and use TurnstileCaptchaField

from django import forms
from django_cf_turnstile.fields import TurnstileCaptchaField


class CaptchaSignupForm(forms.Form):
    ...
    captcha = TurnstileCaptchaField()

Customization

Overriding Keys

Keys may be overridden on individual forms by passing in site_key and secret_key.

class CaptchaSignupForm(forms.Form):
    captcha = TurnstileCaptchaField(
       site_key="3x00000000000000000000FF",
       secret_key="1x0000000000000000000000000000000AA"
    )

Adding Labels

By default, the label is set to an empty string. This can be overridden by setting label.

class CaptchaSignupForm(forms.Form):
    captcha = TurnstileCaptchaField(label="Captcha")

Credits

Inspired by django-recaptcha

Release files for django-cf-turnstile 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-cf-turnstile 0.1.0
File Size Uploaded
django_cf_turnstile-0.1.0.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-cf-turnstile 0.1.0
File Interpreter ABI Platform
django_cf_turnstile-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.2 kB

Release files / django_cf_turnstile-0.1.0.tar.gz

Download URL django_cf_turnstile-0.1.0.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bdc2e06d2dd75d18f6be53436c4a58b467cac7f0ef7737989c4eaa814b9d6b5f
BLAKE2b-256 checksum
How to use checksums
579709cd52730e58d9a227802b779a397c7705c287429f9cbab2084bcdda6ac4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2025.

Transparency log

Release files / django_cf_turnstile-0.1.0-py3-none-any.whl

Download URL django_cf_turnstile-0.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2acfcda3cb85eefb43da63bddbc833776fbd901726d1b1e744eee5f1009d197f
BLAKE2b-256 checksum
How to use checksums
7aec92abc03db369177f12b5685ee96aa3706d194ad1d45ac918f1d07f124689
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page