django admin 后台管理登陆快速添加验证码功能

2023-01-2110:26:11后端程序开发Comments1,064 views字数 488阅读模式

1. 安装包文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30515.html

pip install django-multi-captcha-admin django-simple-captcha

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30515.html

2. setting.py文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30515.html

INSTALLED_APPS = [
    'xxxxxxx', #系统内置的模块
    '....',    
    'app01',
    'multi_captcha_admin',    #1    
    'django.contrib.admin',   #2 把默认的admin剪切放到这里,固定这个顺序,
    'captcha',                #3

]
MULTI_CAPTCHA_ADMIN = { 'engine': 'simple-captcha', } # 选择recaptcha2

同时还支持recaptcha 和recaptcha2两种方式,但是由google提供,需要FQ。(人机验证,语音验证)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30515.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30515.html

3.urls.py文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30515.html

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^captcha/', include('captcha.urls')),

]

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30515.html

4.初始化文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30515.html

python manage.py migrate
python manage.py createsuperuser

5. 访问文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30515.html

django admin 后台管理登陆快速添加验证码功能文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/30515.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/bc/30515.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定