Django AUTH_PASSWORD_VALIDATORS没有看到我的验证器

时间:2018-11-22 13:17:14

标签: python django

我需要带有俄语消息的密码验证器,所以我重写了现有的验证器。 个人页面/帐户页面/validators.py

from django.core.exceptions import ValidationError
from django.conf.urls import url, Path
from django.utils.translation import gettext as _

class MyUserAttributeSimilarityValidator:
...


class MyMinimumLengthValidator:
...

class MyCommonPasswordValidator:
...


class MyNumericPasswordValidator:
...

另外,我在settings.py中指出了它们 personalpage / account / settings.py:

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',    
'accountpage',
]
...
AUTH_PASSWORD_VALIDATORS = [
{
    'NAME': 'accountpage.validators.MyUserAttributeSimilarityValidator',
},
{
    'NAME': 'accountpage.validators.MyMinimumLengthValidator',
},
{
    'NAME': 'accountpage.validators.MyCommonPasswordValidator',
},
{
    'NAME': 'accountpage.validators.MyNumericPasswordValidator',
},

]

但是当我注册新用户时,我得到error

为什么django没有看到我的验证器?

0 个答案:

没有答案