django验证码模块使用

1.下载模块

pip install django-simple-captcha   

2.在一级urls内配置URL

url(r'^captcha/', include('captcha.urls')),

3.settiongs注册

INSTALLED_APPS = [
     'captcha',    
]

4.生成验证码表数据库

python manage.py  migrate

5.在forms组件中添加

from captcha.fields import CaptchaField
captcha=CaptchaField()

6.前端使用

{{ form.captcha}} 

  

原文地址:https://www.cnblogs.com/xzcvblogs/p/11365781.html