text: """
  Django settings for icarus_backend project.
  
  Generated by 'django-admin startproject' using Django 2.0.7.
  
  For more information on this file, see
  https://docs.djangoproject.com/en/2.0/topics/settings/
  
  For the full list of settings and their values, see
  https://docs.djangoproject.com/en/2.0/ref/settings/
  """
  
  import os
  import sys
  from django.utils.log import DEFAULT_LOGGING
  from celery.schedules import crontab
  
  from icarus_backend.secrets import secrets
  
  LOGGING = DEFAULT_LOGGING
  
  LOGGING['handlers']['slack_admins'] = {
    'level': 'ERROR',
    'filters': ['require_debug_false'],
    'class': 'slack_logger.SlackExceptionHandler',
  }
  
  LOGGING['loggers']['django'] = {
    'handlers': ['console', 'slack_admins'],
    'level': 'INFO',
  }
  
  # 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/2.0/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = 'zcr39#y7%e9a$r+n=72uw6@2k_o*fw-)so&fl&@_+1v0v+@in@'
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = secrets['debug']
  
  CORS_ORIGIN_ALLOW_ALL = True
  CORS_ORIGIN_WHITELIST = (
      'localhost:8080',
      'dev.icarusmap.com',
      'icarusmap.com',
      'www.icarusmap.com',
      'api.icarusmap.com'
  )
  
  EMAIL_USE_SSL = False
  EMAIL_USE_TLS = secrets['email']['tls']
  EMAIL_HOST = secrets['email']['host']
  EMAIL_HOST_USER = secrets['email']['username']
  EMAIL_HOST_PASSWORD = secrets['email']['password']
  EMAIL_PORT = secrets['email']['port']
  
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'django.contrib.gis',
      'icarus_backend',
      'djgeojson',
      'rest_framework',
      'users',
      'oauth2_provider',
      'notifications',
      'django_celery_beat',
  ]
  
  REST_FRAMEWORK = {
      'DEFAULT_AUTHENTICATION_CLASSES': (
          'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
      )
  }
  
  OAUTH2_PROVIDER = {
      # this is the list of available scopes
      'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'},
      'ACCESS_TOKEN_EXPIRE_SECONDS': 36000,
  }
  
  MIDDLEWARE = [
      'corsheaders.middleware.CorsMiddleware',
      'django.middleware.security.SecurityMiddleware',
      'django.contrib.sessions.middleware.SessionMiddleware',
      'oauth2_provider.middleware.OAuth2TokenMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
      'icarus_backend.middleware.DisableCSRF.DisableCSRF',
  ]
  
  ROOT_URLCONF = 'icarus_backend.urls'
  
  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',
              ],
          },
      },
  ]
  
  WSGI_APPLICATION = 'icarus_backend.wsgi.application'
  
  # Database
  # https://docs.djangoproject.com/en/2.0/ref/settings/#databases
  
  DATABASES = {
      # 'default': {
      #     'ENGINE': 'django.db.backends.sqlite3',
      #     'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
      # }
      'default': {
          'ENGINE': 'django.contrib.gis.db.backends.postgis',
          'NAME': secrets["database"]["name"],
          'USER': secrets["database"]["user"],
          'PASSWORD': secrets["database"]["password"],
          'HOST': secrets["database"]["host"],
          'PORT': '',
      }
      # 'default': {
      #     'ENGINE': 'django.contrib.gis.db.backends.postgis',
      #     'NAME': 'icarus_db',
      #     'USER': 'django_user',
      #     'PASSWORD': 'ignorance_is_strength_war_is_peace_ingsoc',
      #     'HOST': 'dev.icarusmap.com',
      #     'PORT': '5432',
      # }
  }
  
  # Password validation
  # https://docs.djangoproject.com/en/2.0/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',
      },
  ]
  
  ALLOWED_HOSTS = [
      'localhost',
      'localhost:8000',
      '127.0.0.1',
      '127.0.0.1:8000',
      'dev.icarusmap.com',
      'devapi.icarusmap.com',
      'api.icarusmap.com',
      'icarusmap.com',
      '0.0.0.0:8000',
      '0.0.0.0',
      '54.210.169.20',
      'ec2-54-210-169-20.compute-1.amazonaws.com',
      '34.238.115.176',
      'ec2-34-238-115-176.compute-1.amazonaws.com',
  ]
  
  AUTHENTICATION_BACKENDS = (
      'django.contrib.auth.backends.ModelBackend',  # default
      'oauth2_provider.backends.OAuth2Backend'
  )
  
  AUTH_USER_MODEL = 'users.IcarusUser'
  
  # REDIS related settings
  REDIS_HOST = 'localhost'
  REDIS_PORT = '6379'
  BROKER_URL = 'redis://' + REDIS_HOST + ':' + REDIS_PORT + '/0'
  BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 3600}
  CELERY_RESULT_BACKEND = 'redis://' + REDIS_HOST + ':' + REDIS_PORT + '/0'
  
  # Internationalization
  # https://docs.djangoproject.com/en/2.0/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/2.0/howto/static-files/
  
  STATIC_URL = '/static/'
  