"""
Django settings for source project.

Generated by 'django-admin startproject' using Django 1.11.2.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""

import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases

# Application definition

DJANGO_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
)

THIRD_PARTY_APPS = (
    'rest_framework',
    'rest_framework.authtoken',
    'rest_auth',
    'django.contrib.sites',
    'allauth',
    'allauth.account',
    'rest_auth.registration',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.facebook',
    'allauth.socialaccount.providers.twitter',
    'allauth.socialaccount.providers.google',
    'corsheaders',
    'django_celery_results',
)

# Apps specific for this project go here.
LOCAL_APPS = (
    'source',
    'userprofile',
    'task',
)

#Django-allauth site_id
SITE_ID = 1

INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS

#Configure django-rest-framework permissions to accept JSON Web tokens by default.
REST_FRAMEWORK = {
  'DEFAULT_AUTHENTICATION_CLASSES': (
    'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
  ),
}

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.common.CommonMiddleware',
]

# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

CORS_ORIGIN_ALLOW_ALL = True
REST_USE_JWT = True

from datetime import timedelta

JWT_AUTH = {
    'JWT_RESPONSE_PAYLOAD_HANDLER':
    #'rest_framework_jwt.utils.jwt_response_payload_handler',
    'source.utils.jwt_response_payload_handler',
    'JWT_AUTH_HEADER_PREFIX': 'JWT',
    'JWT_EXPIRATION_DELTA': timedelta(hours=4),
}

########## Celery CONFIGURATION
CELERY_RESULT_BACKEND = 'django-db'
@@ -1034,315 +1034,38 @@
    '
-rest_framework.authtoken',%0A    'rest_auth',%0A    'django.contrib.sites',%0A    'allauth',%0A    'allauth.account',%0A    'rest_auth.registration',%0A    'allauth.socialaccount',%0A    'allauth.socialaccount.providers.facebook',%0A    'allauth.socialaccount.providers.twitter',%0A    'allauth.socialaccount.providers.google
+social.apps.django_app.default
 ',%0A 
@@ -1223,44 +1223,8 @@
 %0A)%0A%0A
-#Django-allauth site_id%0ASITE_ID = 1%0A
 %0AINS
@@ -1422,16 +1422,132 @@
 SES': (%0A
+    'rest_framework.authentication.SessionAuthentication',%0A    'rest_framework.authentication.TokenAuthentication',%0A
     'res
@@ -1988,24 +1988,94 @@
 sors.auth',%0A
+                'social.apps.django_app.context_processors.backends',%0A
             
@@ -3205,16 +3205,16 @@
   %7D,%0A%5D%0A%0A
+
 CORS_ORI
@@ -3237,28 +3237,8 @@
 True
-%0AREST_USE_JWT = True
 %0A%0Afr

Add python social auth settings