django框架管理员登录页面添加验证码功能

c 复制代码
B站视频-3分钟
https://www.bilibili.com/video/BV1TW421P7YD/

Django Simple Captcha 0.6.0 版本

c 复制代码
# 1官网
[Django Simple Captcha --- Django Simple Captcha 0.6.0 documentation (django-simple-captcha.readthedocs.io)](https://django-simple-captcha.readthedocs.io/en/latest/)
# 2使用方法
[Using django-simple-captcha --- Django Simple Captcha 0.6.0 documentation](https://django-simple-captcha.readthedocs.io/en/latest/usage.html)
# 3github项目地址
[GitHub - mbi/django-simple-captcha:Django Simple Captcha 是一个非常简单但高度可定制的 Django 应用程序,可以将验证码图像添加到任何 Django 表单中。](https://github.com/mbi/django-simple-captcha)

1:安装命令

c 复制代码
pip install  django-simple-captcha

2:在django项目中的settings.py中的INSTALLED_APPS中添加安装插件

c 复制代码
INSTALLED_APPS=[

'django内置插件开头'
'django内置插件结尾'
'captch'
]

3:安装完django-simple-captcha之后,才安装django-multi-captcha-admin 多合一版本

django-multi-captcha-admin 多合一版本

c 复制代码
# 1不同展示方式
[GitHub - a-roomana/django-multi-captcha-admin: easy add captcha to login page of django admin](https://github.com/a-roomana/django-multi-captcha-admin)
# 2线上视频
[向 Django 管理员添加验证码 - YouTube](https://www.youtube.com/watch?v=JYEwOSBcKvY&ab_channel=CloudWithDjango) 

1:安装命令

c 复制代码
pip install  django-multi-captcha-admin

2:在django项目中的settings.py中的INSTALLED_APPS中添加安装插件

c 复制代码
INSTALLED_APPS=[
'multi_captcha_admin',
'django内置插件开头'
'django内置插件结尾'
'captcha',
]

3:执行django的迁移

c 复制代码
python manage.py migrate

4:在urls.py中添加captcha路由

c 复制代码
from django.urls import path, include  
  
urlpatterns = [  
    path('admin/', admin.site.urls),  
    path('admin/login/', custom_login, name='custom_login'),  
    path('captcha/',include('captcha.urls')),  
]

5:在settings.py文件中添加 指定的验证码引擎

c 复制代码
MULTI_CAPTCHA_ADMIN={
	'engine':'simple-captcha',
}
MIDDLEWARE=[]

使用recaptcha2引擎

c 复制代码
MULTI_CAPTCHA_ADMIN={
	'engine':'recaptcha2',
}

请参考以下说明
[GitHub - kbytesys/django-recaptcha2: Django reCaptcha v2 field/widget](https://github.com/kbytesys/django-recaptcha2)

使用recaptcha引擎

c 复制代码
MULTI_CAPTCHA_ADMIN={
	'engine':'recaptcha',
}
请参考以下说明
[GitHub - django-recaptcha/django-recaptcha: Django reCAPTCHA form field/widget integration app.](https://github.com/django-recaptcha/django-recaptcha)
相关推荐
啦啦啦_99995 分钟前
Redis-5-doFormatAsync()方法
数据库·redis·c#
生产队队长14 分钟前
Redis:Windows环境安装Redis,并将 Redis 进程注册为服务
数据库·redis·缓存
老邓计算机毕设15 分钟前
SSM找学互助系统52568(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面
数据库·ssm 框架·javaweb 毕业设计
痴儿哈哈18 分钟前
自动化机器学习(AutoML)库TPOT使用指南
jvm·数据库·python
Σίσυφος19001 小时前
PCL法向量估计 之 方向约束法向量(Orientation Guided Normal)
数据库
老毛肚1 小时前
手写mybatis
java·数据库·mybatis
海山数据库1 小时前
移动云大云海山数据库(He3DB)postgresql_anonymizer插件原理介绍与安装
数据库·he3db·大云海山数据库·移动云数据库
云飞云共享云桌面1 小时前
高性能图形工作站的资源如何共享给10个SolidWorks研发设计用
linux·运维·服务器·前端·网络·数据库·人工智能
2501_927993531 小时前
SQL Server 2022安装详细教程(图文详解,非常详细)
数据库·sqlserver
wqq63108551 小时前
Python基于Vue的实验室管理系统 django flask pycharm
vue.js·python·django