add allauth settings and URLs

This commit is contained in:
Jan Dittberner 2015-01-17 16:28:19 +01:00
parent 1782c65bac
commit 286c477efc
2 changed files with 25 additions and 2 deletions

View file

@ -167,6 +167,9 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.tz', 'django.core.context_processors.tz',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request', '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 # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
@ -198,6 +201,15 @@ MIDDLEWARE_CLASSES = (
########## END MIDDLEWARE CONFIGURATION ########## 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 ########## URL CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf # See: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
ROOT_URLCONF = '%s.urls' % SITE_NAME ROOT_URLCONF = '%s.urls' % SITE_NAME
@ -229,6 +241,17 @@ DJANGO_APPS = (
'crispy_forms', '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. # Apps specific for this project go here.
LOCAL_APPS = ( LOCAL_APPS = (
'dashboard', 'dashboard',
@ -242,7 +265,7 @@ LOCAL_APPS = (
) )
# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-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 ########## END APP CONFIGURATION

View file

@ -11,7 +11,7 @@ admin.autodiscover()
urlpatterns = patterns( urlpatterns = patterns(
'', '',
url(r'', include(dashboard.urls)), 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)), url(r'^admin/', include(admin.site.urls)),
) )