如何通过长尾关键词优化注册后台,提升用户体验?
- 内容介绍
- 文章标签
- 相关推荐
本文共计147个文字,预计阅读时间需要1分钟。
使用插件captcha生成验证码:pip install django-simple-captcha==0.4.6,在setting.py中的INSTALLED_APPS中注册captcha:'captcha'
利用插件captcha生成验证码
注册capatcha:
pip install django-simple-captcha==0.4.6在setting.py中的INSTALLED_APPS中增加’capatcha’
在form.py中写入:
from captcha.fields import CaptchaFieldclass RegisterForm(forms.Form): email = forms.CharField(required=True) password = forms.CharField(required=True, min_length=5) captcha = CaptchaField(error_messages={"invalid":u"验证码错误"})在views.py 中写入:
class RegisterView(View): def get(self, request): register_form = RegisterForm(request.POST) return render(request, "register.html", {'register_form':register_form})register.html 加入{{ register_form.captcha }} 运行makemigrations 、migrate 更新数据库 效果如下:
本文共计147个文字,预计阅读时间需要1分钟。
使用插件captcha生成验证码:pip install django-simple-captcha==0.4.6,在setting.py中的INSTALLED_APPS中注册captcha:'captcha'
利用插件captcha生成验证码
注册capatcha:
pip install django-simple-captcha==0.4.6在setting.py中的INSTALLED_APPS中增加’capatcha’
在form.py中写入:
from captcha.fields import CaptchaFieldclass RegisterForm(forms.Form): email = forms.CharField(required=True) password = forms.CharField(required=True, min_length=5) captcha = CaptchaField(error_messages={"invalid":u"验证码错误"})在views.py 中写入:
class RegisterView(View): def get(self, request): register_form = RegisterForm(request.POST) return render(request, "register.html", {'register_form':register_form})register.html 加入{{ register_form.captcha }} 运行makemigrations 、migrate 更新数据库 效果如下:

