text: """
  Django settings for bluehealth project.
  
  Generated by 'django-admin startproject' using Django 1.11.7.
  
  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 environ
  import dj_database_url
  
  # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  
  # BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  BASE_DIR = environ.Path(__file__) - 3
  APPS_DIR = BASE_DIR.path('bluehealth')
  
  # Load operating system environment variables and then prepare to use them
  env = environ.Env()
  
  # .env file, should load only in development environment
  READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)
  
  if READ_DOT_ENV_FILE:
      # Operating System Environment variables have precedence over variables
      # defined in the .env file, that is to say variables from the .env files
      # will only be used if not defined as environment variables.
  
      env_file = str(BASE_DIR.path('.env'))
      print('Loading : {}'.format(env_file))
      env.read_env(env_file)
      print('The .env file has been loaded. See base.py for more information')
  
  # DEBUG
  # ------------------------------------------------------------------------------
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
  DEBUG = env.bool('DJANGO_DEBUG', False)
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
  
  
  ALLOWED_HOSTS = ['*']
  
  DATABASES = {}
  DATABASES['default'] = dj_database_url.config(conn_max_age=600)
  DATABASES['default'] = dj_database_url.config(
      default='postgres://poddar:iotproj@localhost:5432/bluehealth2')
  
  # 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',
      'django_celery_beat',
      'django_celery_results',
      'djcelery_email'
  ]
  
  LOCAL_APPS = [
      'bluehealth.devices',
      'bluehealth.observations',
      'bluehealth.users'
  ]
  
  AUTH_USER_MODEL = 'users.CustomUser'
  
  INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
  
  
  CELERY_BROKER_URL = 'redis://localhost:6379'
  CELERY_RESULT_BACKEND = 'redis://localhost:6379'
  CELERY_ACCEPT_CONTENT = ['application/json']
  CELERY_TASK_SERIALIZER = 'json'
  CELERY_RESULT_SERIALIZER = 'json'
  
  MIDDLEWARE = [
      'django.middleware.security.SecurityMiddleware',
      'whitenoise.middleware.WhiteNoiseMiddleware',
      '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',
  ]
  
  REST_FRAMEWORK = {
      'DEFAULT_PERMISSION_CLASSES': (
          'rest_framework.permissions.IsAuthenticated',
      ),
      'DEFAULT_AUTHENTICATION_CLASSES': (
          'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
          'rest_framework.authentication.SessionAuthentication',
          'rest_framework.authentication.BasicAuthentication',
      ),
  }
  
  EMAIL_HOST = 'smtp.gmail.com'
  
  EMAIL_PORT = 587
  
  EMAIL_HOST_USER = 'test@gmail.com'
  
  EMAIL_HOST_PASSWORD = 'a3bfia8gn'
  
  EMAIL_USE_TLS = True  # TLS settings
  
  EMAIL_BACKEND = 'djcelery_email.backends.CeleryEmailBackend'
  
  
  # URL Configuration
  # ------------------------------------------------------------------------------
  ROOT_URLCONF = 'config.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [str(APPS_DIR.path('templates'))],
          'OPTIONS': {
              # See:
              # https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
              'debug': DEBUG,
              # See:
              # https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
              # https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types
              'loaders': [
                  'django.template.loaders.filesystem.Loader',
                  'django.template.loaders.app_directories.Loader',
              ],
              '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 = 'config.wsgi.application'
  
  # SECRET CONFIGURATION
  # ------------------------------------------------------------------------------
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
  # Note: This key only used for development and testing.
  SECRET_KEY = env(
      'DJANGO_SECRET_KEY',
      default='oc8c#+$3!9shctepsme+gwz%ne))4qm^vrfgx(v-l8d3@m5&fl'
  )
  
  # 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',
      },
  ]
  
  
  # Internationalization
  # https://docs.djangoproject.com/en/1.11/topics/i18n/
  
  LANGUAGE_CODE = 'en-us'
  
  TIME_ZONE = 'America/New_York'
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  
  # STATIC FILE CONFIGURATION
  # ------------------------------------------------------------------------------
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
  STATIC_ROOT = str(BASE_DIR('staticfiles'))
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
  STATIC_URL = '/static/'
  
  # See:
  # https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
  STATICFILES_DIRS = [
      str(APPS_DIR.path('static')),
  ]
  
  # See:
  # https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
  STATICFILES_FINDERS = [
      'django.contrib.staticfiles.finders.FileSystemFinder',
      'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  ]
  
  STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
  
  # MEDIA CONFIGURATION
  # ------------------------------------------------------------------------------
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
  MEDIA_URL = '/media/'
  MEDIA_ROOT = str(APPS_DIR('media'))
  
  LOGIN_REDIRECT_URL  = 'home'
  LOGOUT_REDIRECT_URL = 'home'