diff --git a/gnuviechadmin/gnuviechadmin/settings/base.py b/gnuviechadmin/gnuviechadmin/settings/base.py index 2fa3fdd..29ebe88 100644 --- a/gnuviechadmin/gnuviechadmin/settings/base.py +++ b/gnuviechadmin/gnuviechadmin/settings/base.py @@ -167,6 +167,9 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.tz', 'django.contrib.messages.context_processors.messages', 'django.core.context_processors.request', + # allauth specific context processors + 'allauth.account.context_processors.account', + 'allauth.socialaccount.context_processors.socialaccount', ) # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders @@ -198,6 +201,15 @@ MIDDLEWARE_CLASSES = ( ########## END MIDDLEWARE CONFIGURATION +AUTHENTICATION_BACKENDS = ( + # Needed to login by username in Django admin, regardless of `allauth` + "django.contrib.auth.backends.ModelBackend", + + # `allauth` specific authentication methods, such as login by e-mail + "allauth.account.auth_backends.AuthenticationBackend", +) + + ########## URL CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf ROOT_URLCONF = '%s.urls' % SITE_NAME @@ -229,6 +241,17 @@ DJANGO_APPS = ( 'crispy_forms', ) +ALLAUTH_APPS = ( + 'allauth', + 'allauth.account', + 'allauth.socialaccount', + 'allauth.socialaccount.providers.google', + 'allauth.socialaccount.providers.linkedin_oauth2', + 'allauth.socialaccount.providers.openid', + 'allauth.socialaccount.providers.twitter', + 'allauth.socialaccount.providers.xing', +) + # Apps specific for this project go here. LOCAL_APPS = ( 'dashboard', @@ -242,7 +265,7 @@ LOCAL_APPS = ( ) # See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps -INSTALLED_APPS = DJANGO_APPS + LOCAL_APPS +INSTALLED_APPS = DJANGO_APPS + ALLAUTH_APPS + LOCAL_APPS ########## END APP CONFIGURATION diff --git a/gnuviechadmin/gnuviechadmin/urls.py b/gnuviechadmin/gnuviechadmin/urls.py index 73b5f0d..c70d6c7 100644 --- a/gnuviechadmin/gnuviechadmin/urls.py +++ b/gnuviechadmin/gnuviechadmin/urls.py @@ -11,7 +11,7 @@ admin.autodiscover() urlpatterns = patterns( '', url(r'', include(dashboard.urls)), - url(r'^accounts/login/$', 'django.contrib.auth.views.login', name='login'), + url(r'^accounts/', include('allauth.urls')), url(r'^admin/', include(admin.site.urls)), )