-1

Now I'm working on a Django project. We are using django-allauth for the user registration.

When we try to login with the wrong password, if Debug = True, everything was ok; but if Debug = False, then the following exception happens:

During handling of the above exception (authenticate() got an unexpected keyword argument 'email'),
another exception occurred:

Traceback (most recent call last):
  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/utils/decorators.py", line 67, in _wrapper
    return bound_func(*args, **kwargs)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper

    return view(request, *args, **kwargs)
  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/utils/decorators.py", line 63, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/allauth/account/views.py", line 133, in dispatch
    return super(LoginView, self).dispatch(request, *args, **kwargs)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/allauth/account/views.py", line 79, in dispatch
    **kwargs)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/allauth/account/views.py", line 101, in post
    if form.is_valid():

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/forms/forms.py", line 183, in is_valid
    return self.is_bound and not self.errors

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/forms/forms.py", line 175, in errors
    self.full_clean()

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/forms/forms.py", line 385, in full_clean
    self._clean_form()

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/forms/forms.py", line 412, in _clean_form
    cleaned_data = self.clean()

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/allauth/account/forms.py", line 159, in clean
    **credentials)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/allauth/account/adapter.py", line 483, in authenticate
    user = authenticate(request=request, **credentials)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/allauth/compat.py", line 52, in authenticate
    return authenticate(request=request, **credentials)

  File "/Volumes/data/Peak/pyenv/lib/python3.6/site-packages/django/contrib/auth/__init__.py", line 77, in authenticate
    inspect.getcallargs(backend.authenticate, request=request, **credentials)

KeyError: 'request'
2018-06-19 17:44:54,697 "POST /accounts/login/ HTTP/1.1" 500 160691
ERROR:django.server:"POST /accounts/login/ HTTP/1.1" 500 160691

How can I fix that?

We are using python3.

6
  • With such a vague description and no code, we can only tell you equally vague things (like "you can solve this problem by debugging"). Post a minimal reproducible example. Jun 19, 2018 at 17:17
  • django-allauth is a 3rd party package.
    – Daniel Lee
    Jun 19, 2018 at 17:37
  • Here is my error log on the console. I tried to upload my web pages but I'm not allowed yet because my reputation is lower than 10. Would you please answer with that error log? I just installed django-allauth and include it's url and url(r'^accounts/', include('allauth.urls')),
    – Daniel Lee
    Jun 19, 2018 at 17:49
  • Again when I login with correct email and password, or Debug==True, then I don't get that error.
    – Daniel Lee
    Jun 19, 2018 at 17:54
  • @DanielLee if you follow the Minimal, Complete, and Verifiable example link posted earlier, you'll see that it's recommended that you include a sample of your source code.
    – 0xdd
    Jun 19, 2018 at 20:27

1 Answer 1

0

Need to upgrade Django version. This is not the code error. Just Django version error. Install Django 1.11.4. It works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.