DjangoCaptcha 介绍
在django中生成英文单词验证码,提供验证码图片生成,检查验证码等功能
原用于pythoner.net的验证码,现整理出来打包发布到pypi.
Usage
pip install DjangoCaptcha or easy_install DjangoCaptcha
from DjangoCaptcha import Captcha def code(request): ca = Captcha(request) ca.words = ['hello','world','helloworld'] ca.type = 'number' return ca.display()
from DjangoCaptcha import Captcha def index(request): _code = request.GET.get('code') or '' if not _code: return render('index.html',locals()) ca = Captcha(request) if ca.check(_code): return HttpResponse('验证成功') else: return HttpResponse('验证失败')
Custom
width of image
ca.img_width = 150
height of
image
ca.img_height = 30
[](https://github.com/tianyu0915/DjangoCaptcha#type-fo-code-
numberword)type fo code (‘number’/’word’)
ca.type = ‘number’
Rely on
- PIL
More
DjangoCaptcha 官网
https://github.com/tianyu0915/DjangoCaptcha
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。