2017-10-19 10 views
1

hye。私は私の新しいカスタムパスワードハッシャーをインポートすることはできませんが、私はまだそれを理解できません。pythonカスタムパスワードハッシャーエラー

エラー:

ImportError at /admin/ 

No module named 'honeywordHasher.hashers.MyHoneywordHasherdjango'; 'honeywordHasher.hashers' is not a package 

私はすでにINSTALLED_APPSに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ともhoneyword世代を作成します。私はまだこのエラーが発生します。誰かが私を助けることができる?

答えて

2

カスタムハッシャーの後にカンマを忘れてしまった。それは次のようになります。コンマなし

'honeywordHasher.hashers.MyHoneywordHasher', 

、Pythonのconcatenatesインポートエラーが発生し'honeywordHasher.hashers.MyHoneywordHasherdjango.contrib.auth.hashers.PBKDF2PasswordHasher'を形成するために、次の行に1、を持つ文字列。