django验证码django-simple-captha
2024-09-06 10:42:23
搭建网站很经常要用到验证码,django中就有这样的中间件django-simple-captha
githup地址https://github.com/mbi/django-simple-captcha.git
下载完之后,切换到下载的目录下pip install django-simple-captcha安装
如何使用
一在setting中install_app中添加captcha
二运行python manage.py makemigrations captcha,python manage.py migrate captcha
三在urls中添加
url(r'^captcha/', include('captcha.urls')),
在form中添加一个CaptchaField
from django import forms
from captcha.fields import CaptchaField class CaptchaTestForm(forms.Form):
myfield = AnyOtherField()
captcha = CaptchaField()
到时候验证form的时候如果验证码不正确会提示不合法
四在html添加captcha
<form action='.' method='POST'>
{{ form.captcha }}
<input type="submit" />
<button class='js-captcha-refresh'></button>
</form>
注意点击更改验证码要自己写js实现哦
最新文章
- [Asp.net 5] ApplicationBuilder详解
- ArcGIS 10.5新功能预览
- interactivePopGestureRecognizer
- python发邮件实现Redis通知功能
- 除了白名单外的IP每秒最多处理 8 个请求 limit_conn_zone
- 求二叉树的深度和宽度[Java]
- 武汉科技大学ACM:1009: 华科版C语言程序设计教程(第二版)习题5.12
- 在SSH整合框架中经常会用到Service层,请问大家这个Service层有什么具体的作用,可不可以不用这个Service层呢?
- 标签(Tag)的各种设计方案
- hdu1198--并查集
- Python开发【第十六篇】:AJAX全套(转)
- 使用Mongo进行分页
- 源码分析八( hashmap工作原理)
- web socket
- js条件判断if-else和switch、循环for和while
- library之目录
- [python]python安装包错误
- 4gcc编译器
- anaconda安装出现failed to create anacoda menue
- Bat 获取本地代码的Svn Revision并保存到变量
热门文章
- 湘潭邀请赛 2018 D Circular Coloring
- 如何用js让表格的行也能拖动
- spring in action 学习笔记十:用@PropertySource避免注入外部属性的值硬代码化
- elementui 日期选择器设置当前默认日期(picker-options),以及当前日期以后的无法选择(default-value)
- .net使用memcached
- php5.3+ 安装(mysqlnd )
- nginx 根据url访问次数限制
- Zabbix监控服务器异常IP登录
- 兼容ie7到ie11,edge,chrome,firefox的ajax发送接收post数据代码
- Python基础-迭代器&;生成器&;装饰器