The most likely cause is that there is some difference in the data associated with the user, so the login is doing something different for the user that fails. We have a help page on debugging 502 error here: https://help.pythonanywhere.com/pages/502BadGateway/