django验证码模块 DjangoVerifyCode
2013-05-06 23:23
239 查看
1.下载:git clone https://github.com/tianyu0915/DjangoVerifyCode.git
2. cd $dir;python setup.py install
输出图片的宽度
输出图片的高度
设置验证码类型('number'/'world')
2. cd $dir;python setup.py install
显示验证码(views.py)
from DjangoVerifyCode import Code def code(request): code = Code(request) code.worlds = ['hello','world','helloworld'] #code.type = 'world' code.type = 'number' return code.display()
检查用户输入的验证码是否正确(views.py)
from DjangoVerifyCode import Code def index(request): _code = request.GET.get('code') or '' if not _code: return render('index.html',locals()) code = Code(request) if code.check(_code): return HttpResponse('验证成功') else: return HttpResponse('验证失败')
自定义
用户可根据自己的需要对DjangoVerifyCode.Code对象的属性进行设置输出图片的宽度
code.img_width= 150
输出图片的高度
code.img_height= 30
设置验证码类型('number'/'world')
code.type = 'number'
依赖
PIL相关文章推荐
- 第三百八十三节,Django+Xadmin打造上线标准的在线教育平台—第三方模块django-simple-captcha验证码
- Django_随机验证码
- Python 使用Pillow模块生成验证码
- django验证模块
- Django 定制验证码
- Python使用PIL模块生成随机验证码
- Django验证模块
- [py][mx]django邮箱注册的验证码部分-django-simple-captcha库使用
- [py][mx]django分页第三方模块django-pure-pagination
- python--random模块(产生随机值)、洗牌、验证码应用
- django 单独测试模块
- ASP.NET MVC中验证码验证模块
- 使用Django开发一个图书管理系统----04.通过admin模块管理我们的app和model
- Django中示例验证码的实现总结
- Django Admin后台管理模块的使用
- PHP自动生成验证码【留言板模块】
- django自动重新加载模块 源码分析
- Java Web模块——验证码模块
- gunicorn模块(django与nginx整合)
- django.db 模块