Django hCaptcha provides a simple way to protect your django forms using hCaptcha.
Configuration
Add “django-hcaptcha” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...
'hcaptcha',
]
For development purposes no further configuration is required. By default, django-hCaptcha will use dummy keys.
For production, you’ll need to obtain your hCaptcha site key and secret key and add them to you settings:
HCAPTCHA_SITEKEY = '<your sitekey>' HCAPTCHA_SECRET = '<your secret key>'
You can also configure your hCaptcha widget globally (see all options):
HCAPTCHA_DEFAULT_CONFIG = {
'onload': 'name_of_js_function',
'render': 'explicit',
'theme': 'dark', # do not use data- prefix
'size': 'compact', # do not use data- prefix
...
}
If you need to, you can also override default hcaptcha endpoints:
HCAPTCHA_JS_API_URL = 'https://hcaptcha.com/1/api.js' HCAPTCHA_VERIFY_URL = 'https://hcaptcha.com/siteverify'
Use proxies:
HCAPTCHA_PROXIES = {
'http': 'http://127.0.0.1:8000',
}
Change default verification timeout:
HCAPTCHA_TIMEOUT = 5
Usage
Simply add hCaptchaField to your forms:
from hcaptcha.fields import hCaptchaField
class Forms(forms.Form):
....
hcaptcha = hCaptchaField()
....
You can override default config by passing additional arguments:
class Forms(forms.Form):
....
hcaptcha = hCaptchaField(theme='dark', size='compact')
....
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-hCaptcha-0.1.0.tar.gz.
File metadata
- Download URL: django-hCaptcha-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b80197c07bb8444249bcce3758b0472d369cca309fb02d7abcd0a856431b76b
|
|
| MD5 |
a36167683fa2427b9723239eaf8ba7a7
|
|
| BLAKE2b-256 |
b9ef39e0f0442ff8bb800654aa5f43649ba5f9914b465b51af291017021a0fa4
|