django验证码模块 DjangoVerifyCode

码农软件 · 软件分类 · 验证码(Captcha) · 2019-04-22 12:14:30

软件介绍

在django中生成英文单词验证码,提供验证码图片生成,检查验证码等功能.

安装

pip install DjangoVerifyCode
or
easy_install DjangoVerifyCode

显示验证码(views.py)

from DjangoVerifyCode import Code
def code(request):
    code = Code(request)
    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

验证码字体颜色

code.font_color = ['black','darkblue','darkred']

字体大小

font_size = 24

依赖

  • PIL

More

本文地址:https://www.codercto.com/soft/d/4133.html

编程大师访谈录

编程大师访谈录

Susan Lammers / 李琳骁、吴咏炜、张菁 / 人民邮电出版社 / 2012-1 / 59.00元

《编程大师访谈录》是对19位计算机行业先驱的采访实录,采访对象包括查尔斯•西蒙尼、比尔•盖茨、安迪•赫兹菲尔德、雷•奥奇、杰夫•拉斯金等。访谈涉及他们软件创造过程的灵感、技术、编程习惯、动机、反思,以及对未来软件的畅想等。问答中集结了这些计算机先驱的精辟言论,处处闪烁着智慧的火花。 《编程大师访谈录》适合IT从业人员阅读。一起来看看 《编程大师访谈录》 这本书的介绍吧!

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具