I have proble with login to Django web admin. It produces bellow exception:

Internal Server Error: /adminlogin/
 Traceback (most recent call last):
   File 
"/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", 
line 41, in inner
     response = get_response(request)
   File 
"/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 
187, in _get_response
     response = self.process_exception_by_middleware(e, request)
   File 
"/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 
185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py", 
line 57, in _wrapped_view_func
     response = view_func(request, *args, **kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/contrib/admin/sites.py", 
line 393, in login
   File 
"/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 
68, in view
     return self.dispatch(request, *args, **kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 
67, in _wrapper
     return bound_func(*args, **kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/views/decorators/debug.py", 
line 76, in sensitive_post_parameters_wrapper
     return view(request, *args, **kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 
63, in bound_func
     return func.__get__(self, type(self))(*args2, **kwargs2)
   File 
"/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 
67, in _wrapper
     return bound_func(*args, **kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 
149, in _wrapped_view
    response = view_func(request, *args, **kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 
63, in bound_func
     return func.__get__(self, type(self))(*args2, **kwargs2)
   File 
"/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 
67, in _wrapper
     return bound_func(*args, **kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py", 
line 57, in _wrapped_view_func
     response = view_func(request, *args, **kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 
63, in bound_func
     return func.__get__(self, type(self))(*args2, **kwargs2)
   File 
"/usr/local/lib/python3.6/site-packages/django/contrib/auth/views.py", line 
90, in dispatch
     return super(LoginView, self).dispatch(request, *args, **kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 
88, in dispatch
     return handler(request, *args, **kwargs)
   File 
"/usr/local/lib/python3.6/site-packages/django/views/generic/edit.py", line 
182, in post
     if form.is_valid():
   File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", 
line 183, in is_valid
     return self.is_bound and not self.errors
   File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", 
line 175, in errors
     self.full_clean()
   File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", 
line 385, in full_clean
     self._clean_form()
   File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", 
line 412, in _clean_form
     cleaned_data = self.clean()
   File 
"/usr/local/lib/python3.6/site-packages/django/contrib/auth/forms.py", line 
187, in clean
     self.user_cache = authenticate(self.request, username=username, 
password=password)
   File 
"/usr/local/lib/python3.6/site-packages/django/contrib/auth/__init__.py", 
line 70, in authenticate
     user = _authenticate_with_backend(backend, backend_path, request, 
credentials)
   File 
"/usr/local/lib/python3.6/site-packages/django/contrib/auth/__init__.py", 
line 116, in _authenticate_with_backend
     return backend.authenticate(*args, **credentials)
   File 
"/usr/local/lib/python3.6/site-packages/django/contrib/auth/backends.py", 
line 24, in authenticate
     if user.check_password(password) and self.user_can_authenticate(user):
   File 
"/usr/local/lib/python3.6/site-packages/django/contrib/auth/base_user.py", 
line 118, in check_password
     return check_password(raw_password, self.password, setter)
   File 
"/usr/local/lib/python3.6/site-packages/django/contrib/auth/hashers.py", 
line 52, in check_password
     is_correct = hasher.verify(password, encoded)
   File 
"/usr/local/lib/python3.6/site-packages/django/contrib/auth/hashers.py", 
line 265, in verify
     encoded_2 = self.encode(password, salt, int(iterations))
   File 
"/usr/local/lib/python3.6/site-packages/django/contrib/auth/hashers.py", 
line 258, in encode
     hash = pbkdf2(password, salt, iterations, digest=self.digest)
   File "/usr/local/lib/python3.6/site-packages/django/utils/crypto.py", 
line 140, in pbkdf2
     digest().name, password, salt, iterations, dklen)
ValueError: [digital envelope routines: EVP_MD_CTX_copy_ex] input not 
initialized

The critical place is
  hashlib.pbkdf2_hmac(digest().name, password, salt, iterations, dklen)
in crypto.py

I tried the same function manually in a Python terminal with the identical 
arguments:
  hashlib.pbkdf2_hmac('sha256', 'XXXXX', 'XXXXX', 36000, None)
It works OK. But if I call it in the same fashion anywhere in Django 
project it causes the exception.

Uses versions:
  FreeBSD 10.3
  Apache 2.2.23
  WSGI 4.5.24
  Python 3.6.4
  Django 1.11.10

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5338a654-5183-4a0d-aaf5-ec69ae41b262%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to