Search code examples
djangodjango-allauth

django allauth not working on production


I can't login or signup on my production server. Configuration is same for local and development server. I used same settings for both of them, same requirements installed in order to identify what's wrong but no hope.

python manage.py check
System check identified no issues (0 silenced).

some of related configuration

SITE_ID = 1

from django.core.urlresolvers import reverse_lazy

LOGIN_REDIRECT_URL = reverse_lazy('amazon_advertising:home')
LOGIN_URL = reverse_lazy('account_login')
LOGOUT_URL = reverse_lazy('account_logout')

ACCOUNT_AUTHENTICATION_METHOD = "username_email"
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 7
ACCOUNT_EMAIL_VERIFICATION = "mandatory"

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend',
)

I can login and logout django admin panel but django allauth login do not work. There is no error just waiting in response.

on production server I run it with

python manage.py 0.0.0.0:8000

I tried nginx+gunicorn same problem exists.

Login view is successfully parsed with my custom template but can not login or signup.

Edit: If I give wrong credentials in login it response me perfectly with "The login and/or password you specified are not correct." but if credentials are right nothing happens.


Solution

  • Ok I found it. When made ACCOUNT_EMAIL_VERIFICATION = "optional" I successfully logged in. That was the superuser created from python manage.py createsuperuser which not automatically verify email.