python自定义密码哈希器错误
惠。我无法导入新的自定义密码哈希器,我仍然无法找出原因 错误:python自定义密码哈希器错误,python,django,password-hash,honeypot,django-custom-user,Python,Django,Password Hash,Honeypot,Django Custom User,惠。我无法导入新的自定义密码哈希器,我仍然无法找出原因 错误: ImportError at /admin/ No module named 'honeywordHasher.hashers.MyHoneywordHasherdjango'; 'honeywordHasher.hashers' is not a package 我已经在已安装的应用程序中安装了honeywordHasher,我在honeywordHasher文件中有init.py 目录: C:. ├───checkout │
ImportError at /admin/
No module named 'honeywordHasher.hashers.MyHoneywordHasherdjango'; 'honeywordHasher.hashers' is not a package
我已经在已安装的应用程序中安装了honeywordHasher,我在honeywordHasher文件中有init.py
目录:
C:.
├───checkout
│ ├───migrations
│ │ └───__pycache__
│ ├───templates
│ └───__pycache__
├───contact
│ ├───migrations
│ │ └───__pycache__
│ ├───templates
│ └───__pycache__
├───custom_user
│ ├───migrations
│ │ └───__pycache__
│ └───__pycache__
├───honeywordHasher
│ ├───migrations
│ │ └───__pycache__
│ └───__pycache__
├───profiles
│ ├───migrations
│ │ └───__pycache__
│ ├───templates
│ │ └───accounts
│ └───__pycache__
├───register
│ ├───migrations
│ ├───templates
│ │ └───accounts
│ └───__pycache__
├───sqlite
├───tryFOUR
│ └───__pycache__
└───__pycache__
settings.py:
PASSWORD_HASHERS = [
'honeywordHasher.hashers.MyHoneywordHasher'
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.Argon2PasswordHasher',
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
]
我已经在honeywordgen.py中创建了hashers.py和蜜词生成。我仍然得到这个错误。有人能帮我吗?您在自定义哈希程序后漏掉了逗号。应该是:
'honeywordHasher.hashers.MyHoneywordHasher',
在不使用逗号的情况下,Python将字符串与下一行上的字符串合并,形成“honeywordHasher.hasher.MyHoneywordHasherdjango.contrib.auth.Hasher.PBKDF2PasswordHasher”
,从而导致导入错误