github authentication
note: don't deploy this on the server without setting the necessary config vars on heroku first, thanks.
This commit is contained in:
parent
e35acb0cdf
commit
b2d77336d3
3 changed files with 23 additions and 0 deletions
20
settings.py
20
settings.py
|
@ -47,6 +47,10 @@ TEMPLATE_CONTEXT_PROCESSORS = [
|
|||
'django.core.context_processors.media',
|
||||
'django.core.context_processors.static',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'social_auth.context_processors.social_auth_by_name_backends',
|
||||
'social_auth.context_processors.social_auth_backends',
|
||||
'social_auth.context_processors.social_auth_by_type_backends',
|
||||
'social_auth.context_processors.social_auth_login_redirect',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'urls'
|
||||
|
@ -66,8 +70,24 @@ INSTALLED_APPS = [
|
|||
'gunicorn',
|
||||
'south',
|
||||
'raven.contrib.django',
|
||||
'social_auth',
|
||||
]
|
||||
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
'social_auth.backends.contrib.github.GithubBackend',
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
]
|
||||
|
||||
LOGIN_URL = '/login/'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGIN_ERROR_URL = '/login/failed/'
|
||||
|
||||
|
||||
assert 'GITHUB_APP_ID' in os.environ, "Set GITHUB_APP_ID in your .env file!"
|
||||
assert 'GITHUB_APP_SECRET' in os.environ, "Set GITHUB_APP_SECRET in your .env file!"
|
||||
GITHUB_APP_ID = os.environ['GITHUB_APP_ID']
|
||||
GITHUB_API_SECRET = os.environ['GITHUB_APP_SECRET']
|
||||
|
||||
from memcacheify import memcacheify
|
||||
|
||||
CACHES = memcacheify()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue