User authorization via login does not work

69 views Asked by At

I try to log in, but I get the error: "'str' object is not callable". What can happen?

from django.contrib.auth import login, authenticate
login="eeiguomfug"
pas="B6AFQJTK"
user = authenticate(username=login, password=pas)
login(request, user)
1

There are 1 answers

0
GProst On BEST ANSWER

You overrode login method with "eeiguomfug" string. Use username variable name instead:

from django.contrib.auth import login, authenticate
username="eeiguomfug"
pas="B6AFQJTK"
user = authenticate(username=username, password=pas)
login(request, user)