文档地址:https://django-simple-captcha.readthedocs.io/en/latest/
1、安装
pip install django-simple-captcha==0.4.6
2、Add captcha to the INSTALLED_APPS in your settings.py
3、加入到路由之中
urlpatterns += [
url(r'^captcha/', include('captcha.urls')),
]
4、生成数据表, makemigrations 、migrate
5、定义Form
To embed a CAPTCHA in your forms, simply add a CaptchaField to the form definition:
from django import forms
from captcha.fields import CaptchaField
class CaptchaTestForm(forms.Form):
myfield = AnyOtherField()
captcha = CaptchaField()