Django使用django-simple-captcha做验证码的实现示例
时间:2022-08-01 10:48:55|栏目:Python代码|点击: 次
安装django-simple-captcha
pip install django-simple-captcha
将captcha 安装在installed_apps里面

将captcha配置url

迁移同步,生成captcha所依赖的表
python manage.py makemigrations python manage.py migrate
将captcha字段在form类当中进行设置, 但是要导入from captcha.fields import CaptchaField

在后台逻辑当中,get请求里面实例化我们的form,将form对象返回到页面

在页面上通过{{ form.captcha}} 获取验证码

效果图






注册成功
栏 目:Python代码
本文标题:Django使用django-simple-captcha做验证码的实现示例
本文地址:http://www.codeinn.net/misctech/209581.html






