1. 安装包

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

 

2. setting.py

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。(人机验证,语音验证)

 

3.urls.py

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

]

 

4.初始化

python manage.py migrate
python manage.py createsuperuser

5. 访问

django admin 登陆快速添加验证码功能