text: """
  Django settings for nomad project.
  
  Generated by 'django-admin startproject' using Django 1.11.10.
  
  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
  
  import dj_database_url
  import pytz
  
  # Setting up email server
  EMAIL_USE_TLS = True
  DEFAULT_EMAIL_SENDER = "Project Travel Mate <projecttravelmate.github.io@gmail.com>"
  EMAIL_HOST = 'smtp.gmail.com'
  EMAIL_HOST_USER = os.environ.get("EMAIL_CONFIG_ADDRESS", "")
  EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_CONFIG_PASSWORD", "")
  
  # 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: keep the secret key used in production secret!
  SECRET_KEY = '5am=k_v$m7)96eare^ul3c8zdl$6sb&yxljidhhyfam+ul$(c!'
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = (os.environ.get('RUNNING_PROD') is None)
  
  ALLOWED_HOSTS = ['localhost', '.herokuapp.com']
  
  # GITHUB credentails for raising issues
  GITHUB_USERNAME = os.environ.get('GITHUB_CONFIG_USERNAME', None)
  GITHUB_PASSWORD = os.environ.get('GITHUB_CONFIG_PASSWORD', None)
  
  # Application definition
  
  INSTALLED_APPS = [
      'api.apps.ApiConfig',
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'rest_framework',
      'rest_framework.authtoken',
  ]
  
  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',
      'whitenoise.middleware.WhiteNoiseMiddleware',
  
      'api.middleware.LastActiveMiddleware',
  ]
  
  ROOT_URLCONF = 'nomad.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 = 'nomad.wsgi.application'
  
  STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
  STATIC_URL = '/static/'
  
  STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
  
  # Database
  # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
  if DEBUG:
      DATABASES = {
          'default': {
              'ENGINE': 'django.db.backends.postgresql',
              'NAME': 'nomad' if DEBUG else os.environ.get("DATABASE_NAME"),
              'USER': 'nomad' if DEBUG else os.environ.get("DATABASE_USER"),
              'PASSWORD': 'pass' if DEBUG else os.environ.get("DATABASE_PASS"),
              'HOST': 'localhost' if DEBUG else os.environ.get("DATABASE_HOST"),
              'PORT': '5432',
          }
      }
  else:
      DATABASES = {
          'default': dj_database_url.config(default=os.environ.get("DATABASE_URL"))
      }
  
  if 'TRAVIS' in os.environ:
      DATABASES = {
          'default': {
              'ENGINE': 'django.db.backends.postgresql_psycopg2',
              'NAME': 'travisci',
              'USER': 'postgres',
              'PASSWORD': '',
              'HOST': 'localhost',
              'PORT': '',
          }
      }
  
  # 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 = 'UTC'
  TIME_ZONE_SUBCLASS = pytz.timezone(TIME_ZONE)
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  REST_FRAMEWORK = {
      # Use Django's standard `django.contrib.auth` permissions,
      # or allow read-only access for unauthenticated users.
      'DEFAULT_PERMISSION_CLASSES': (
          'rest_framework.permissions.IsAuthenticated',
      ),
      'DEFAULT_AUTHENTICATION_CLASSES': (
          'rest_framework.authentication.BasicAuthentication',
          'rest_framework.authentication.TokenAuthentication',
      ),
      'DEFAULT_THROTTLE_CLASSES': (
          'rest_framework.throttling.AnonRateThrottle',
          'rest_framework.throttling.UserRateThrottle',
      ),
      'DEFAULT_THROTTLE_RATES': {
          'anon': '10/hour',
          'user': '1500/hour',
      }
  }
  
  LOGGING = {
      'version': 1,
      'disable_existing_loggers': False,
      'handlers': {
          'console': {
              'class': 'logging.StreamHandler',
          },
      },
      'loggers': {
          'django': {
              'handlers': ['console'],
              'level': os.getenv('DJANGO_LOG_LEVEL', 'ERROR'),
          },
      },
  }
  