text: """
  Django settings for buddy project.
  
  Generated by 'django-admin startproject' using Django 1.8.3.
  
  For more information on this file, see
  https://docs.djangoproject.com/en/1.8/topics/settings/
  
  For the full list of settings and their values, see
  https://docs.djangoproject.com/en/1.8/ref/settings/
  """
  
  # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  import os
  import datetime
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  TEMPLATE_PATH = os.path.join(BASE_DIR, 'static/app')
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  from .keys import SETTINGS_KEY
  
  SECRET_KEY = SETTINGS_KEY
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True
  
  ALLOWED_HOSTS = []
  
  from .keys import EMAIL_HOST_PASSWORD as pw_, EMAIL_HOST_USER as user_
  
  EMAIL_USE_TLS = True
  EMAIL_HOST = 'smtp.gmail.com'
  EMAIL_PORT = 587
  EMAIL_HOST_USER = user_
  EMAIL_HOST_PASSWORD = pw_
  
  # Application definition
  
  INSTALLED_APPS = (
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'rest_framework',
      'djcelery',
      'accounts',
      'activities',
      'comms',
      'analytics'
  )
  
  MIDDLEWARE_CLASSES = (
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
      'django.middleware.security.SecurityMiddleware',
  )
  
  ROOT_URLCONF = 'buddy.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [TEMPLATE_PATH],
          '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',
              ],
          },
      },
  ]
  
  WSGI_APPLICATION = 'buddy.wsgi.application'
  
  
  # Database
  # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
      }
  }
  
  # from buddy.keys import (POSTGRES_PW, POSTGRES_USER, POSTGRES_NAME,
  #                         POSTGRES_HOST, POSTGRES_PORT)
  # DATABASES = {
  #     'default': {
  #         'ENGINE': 'django.db.backends.postgresql_psycopg2',
  #         'NAME': POSTGRES_NAME,
  #         'USER': POSTGRES_USER,
  #         'PASSWORD': POSTGRES_PW,
  #         'HOST': POSTGRES_HOST,
  #         'PORT': POSTGRES_PORT,
  # }}
  
  
  # Internationalization
  # https://docs.djangoproject.com/en/1.8/topics/i18n/
  
  LANGUAGE_CODE = 'en-us'
  
  TIME_ZONE = 'UTC'
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/1.8/howto/static-files/
  
  STATIC_URL = '/static/'
  STATIC_ROOT = 'staticfiles'
  
  STATICFILES_DIRS = (
      os.path.join(BASE_DIR, 'static'),
  )
  
  STATICFILES_FINDERS = (
      'django.contrib.staticfiles.finders.FileSystemFinder',
      'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  )
  REST_FRAMEWORK = {
      'DEFAULT_PERMISSION_CLASSES': (
          'rest_framework.permissions.IsAuthenticated',
      ),
      'DEFAULT_AUTHENTICATION_CLASSES': (
          'rest_framework.authentication.SessionAuthentication',
          'rest_framework.authentication.BasicAuthentication',
          'rest_framework_jwt.authentication.JSONWebTokenAuthentication'
          ),
  
  }
  
  JWT_AUTH = {
      'JWT_ENCODE_HANDLER':
      'rest_framework_jwt.utils.jwt_encode_handler',
  
      'JWT_DECODE_HANDLER':
      'rest_framework_jwt.utils.jwt_decode_handler',
  
      'JWT_PAYLOAD_HANDLER':
      'rest_framework_jwt.utils.jwt_payload_handler',
  
      'JWT_PAYLOAD_GET_USER_ID_HANDLER':
      'rest_framework_jwt.utils.jwt_get_user_id_from_payload_handler',
  
      'JWT_RESPONSE_PAYLOAD_HANDLER':
      #'rest_framework_jwt.utils.jwt_response_payload_handler',
      'buddy.utils.jwt_response_payload_handler',
  
      'JWT_SECRET_KEY': SECRET_KEY,
      'JWT_ALGORITHM': 'HS256',
      'JWT_VERIFY': True,
      'JWT_VERIFY_EXPIRATION': True,
      'JWT_LEEWAY': 0,
      'JWT_EXPIRATION_DELTA': datetime.timedelta(days=1),
      'JWT_AUDIENCE': None,
      'JWT_ISSUER': None,
  
      'JWT_ALLOW_REFRESH': False,
      'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7),
  
      'JWT_AUTH_HEADER_PREFIX': 'JWT',
  }
  
  AUTH_USER_MODEL = 'accounts.User'
  
  #CELERY SETTOMGS
  from celery.schedules import crontab
  
  BROKER_URL = 'redis://localhost:6379/0'
  CELERY_ACCEPT_CONTENT = ['json']
  CELERY_TASK_SERIALIZER = 'json'
  CELERY_RESULT_SERIALIZER = 'json'
  
  #CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
  
  CELERYBEAT_SCHEDULE = {
      # The following three execute once every half hour.
      'call-list': {
          'task': 'comms.tasks.call_list',
          'schedule': crontab(hour='*/1', minute='0,30'),
      },
      'text-warnings': {
        'task': 'comms.tasks.text_warnings',
        'schedule': crontab(hour='*/1', minute='0,30'),
      },
      'email-warnings': {
        'task': 'comms.tasks.email_warnings',
        'schedule': crontab(hour='*/1', minute='0,30'),
      },
      # # executes once every monday at 10:30 UTC
      # 'tweet-winners': {
      #   'task': 'comms.tasks.tweet_winners',
      #   'schedule': crontab(hour=10, minute=30, day_of_week=1),
      # }
  }
  