text: """Common settings and globals."""
  
  
  from datetime import timedelta
  import os
  from os.path import abspath, basename, dirname, join, normpath
  from sys import path
  
  # from djcelery import setup_loader
  
  
  ########## PATH CONFIGURATION
  # Absolute filesystem path to the Django project directory:
  DJANGO_ROOT = dirname(abspath(__file__))
  
  # Absolute filesystem path to the top-level project folder:
  SITE_ROOT = dirname(DJANGO_ROOT)
  
  # Site name:
  SITE_NAME = os.getenv('SITE_NAME', 'project')
  
  # Add our project to our pythonpath, this way we don't need to type our project
  # name in our dotted import paths:
  path.append(DJANGO_ROOT)
  ########## END PATH CONFIGURATION
  
  
  ########## DEBUG CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
  DEBUG = True if os.getenv('DEBUG') == 'true' else False
  
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
  TEMPLATE_DEBUG = DEBUG
  
  TEST_RUNNER = 'django.test.runner.DiscoverRunner'
  ########## END DEBUG CONFIGURATION
  
  
  ########## MANAGER CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
  ADMINS = (
      ('Yannik Messerli', 'yannik.messerli@gmail.com'),
  )
  
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
  MANAGERS = ADMINS
  ########## END MANAGER CONFIGURATION
  
  
  ########## DATABASE CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
  DATABASES = {
      'default': {
          'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql_psycopg2'),
          'NAME': os.getenv('DATABASE_NAME', 'db'),
          'USER': os.getenv('DATABASE_USER', 'user'),
          'PASSWORD': os.getenv('DATABASE_PASSWORD', 'password'),
          'HOST': os.getenv('DATABASE_SERVICE_HOST', 'database'),
          'PORT': os.getenv('DATABASE_SERVICE_PORT', 5432)
      }
  }
  ########## END DATABASE CONFIGURATION
  
  
  ########## GENERAL CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
  TIME_ZONE = 'America/Los_Angeles'
  
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#language-code
  LANGUAGE_CODE = 'en-us'
  
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id
  SITE_ID = 1
  
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
  USE_I18N = True
  
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n
  USE_L10N = True
  
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-tz
  USE_TZ = True
  ########## END GENERAL CONFIGURATION
  
  
  ########## MEDIA CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
  MEDIA_ROOT = normpath(join(DJANGO_ROOT, 'media'))
  
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
  MEDIA_URL = '/media/'
  ########## END MEDIA CONFIGURATION
  
  
  ########## STATIC FILE CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
  STATIC_ROOT = normpath(join(SITE_ROOT, '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 = (
      # normpath(join(DJANGO_ROOT, '../client/dist')),
  )
  
  # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
  STATICFILES_FINDERS = (
      'django.contrib.staticfiles.finders.FileSystemFinder',
      'django.contrib.staticfiles.finders.AppDirectoriesFinder',
      # 'compressor.finders.CompressorFinder',
  )
  ########## END STATIC FILE CONFIGURATION
  
  
  ########## SECRET CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
  SECRET_KEY = os.getenv('SECRET_KEY', '8lu*6g0lg)9z!ba+a$ehk)xt)x%rxgb$i1&amp;022shmi1jcgihb*')
  ########## END SECRET CONFIGURATION
  
  
  ########## FIXTURE CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FIXTURE_DIRS
  FIXTURE_DIRS = (
      normpath(join(DJANGO_ROOT, 'fixtures')),
  )
  ########## END FIXTURE CONFIGURATION
  
  
  ########## TEMPLATE CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [
              # insert your TEMPLATE_DIRS here
          ],
          'APP_DIRS': True,
          'OPTIONS': {
              'context_processors': [
                  # Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
                  # list if you haven't customized them:
                  'django.contrib.auth.context_processors.auth',
                  'django.template.context_processors.debug',
                  'django.template.context_processors.i18n',
                  'django.template.context_processors.media',
                  'django.template.context_processors.static',
                  'django.template.context_processors.tz',
                  'django.contrib.messages.context_processors.messages',
              ],
          },
      },
  ]
  ########## END TEMPLATE CONFIGURATION
  
  
  ########## MIDDLEWARE CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#middleware-classes
  MIDDLEWARE = (
      # Use GZip compression to reduce bandwidth.
      'django.middleware.gzip.GZipMiddleware',
  
      # Default Django middleware.
      'django.middleware.common.CommonMiddleware',
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
  
      # CORS
      'corsheaders.middleware.CorsMiddleware',
  )
  ########## END MIDDLEWARE CONFIGURATION
  
  
  ########## URL CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
  ROOT_URLCONF = '%s.urls' % SITE_NAME
  ########## END URL CONFIGURATION
  
  
  ########## APP CONFIGURATION
  DJANGO_APPS = (
      # Default Django apps:
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.sites',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  
      # Useful template tags:
      'django.contrib.humanize',
  
      # Admin panel and documentation:
      'django.contrib.admin',
      'django.contrib.admindocs',
  )
  
  THIRD_PARTY_APPS = (
      
      # REST
      'rest_framework',
      
      # Auth
      'oauth2_provider',
  
      # CORS
      'corsheaders',
  
  )
  
  LOCAL_APPS = (
  
  )
  
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
  INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
  ########## END APP CONFIGURATION
  
  ########## REST FRAMEWORK CONFIGURATION
  REST_FRAMEWORK = {
      'DEFAULT_AUTHENTICATION_CLASSES': (
          'oauth2_provider.ext.rest_framework.OAuth2Authentication',
      )
  }
  ########## END REST FRAMEWORK CONFIGURATION
  
  
  ########## LOGGING CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
  LOGGING = {
      'version': 1,
      'disable_existing_loggers': False,
      'filters': {
      'require_debug_false': {
          '()': 'django.utils.log.RequireDebugFalse'
          }
      },
      'handlers': {
          'mail_admins': {
              'level': 'ERROR',
              'filters': ['require_debug_false'],
              'class': 'django.utils.log.AdminEmailHandler'
          },
          'console': {
              'level': 'DEBUG',
              'class': 'logging.StreamHandler'
          },
          'file': {
              'level': 'DEBUG',
              'class': 'logging.FileHandler',
              'filename': 'debug.log',
          }
      },
      'loggers': {
          'django.request': {
              'handlers': ['mail_admins', 'console'],
              'level': 'ERROR',
              'propagate': True,
          },
      }
  }
  ########## END LOGGING CONFIGURATION
  
  
  ########## CELERY CONFIGURATION
  # See: http://celery.readthedocs.org/en/latest/configuration.html#celery-task-result-expires
  # CELERY_TASK_RESULT_EXPIRES = timedelta(minutes=30)
  
  # # See: http://docs.celeryproject.org/en/master/configuration.html#std:setting-CELERY_CHORD_PROPAGATES
  # CELERY_CHORD_PROPAGATES = True
  
  # # See: http://celery.github.com/celery/django/
  # setup_loader()
  ########## END CELERY CONFIGURATION
  
  
  ########## WSGI CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
  WSGI_APPLICATION = 'wsgi.application'
  ########## END WSGI CONFIGURATION
  
  
  ########## COMPRESSION CONFIGURATION
  # # See: http://django_compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_ENABLED
  # COMPRESS_ENABLED = True
  
  # # See: http://django-compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_CSS_HASHING_METHOD
  # COMPRESS_CSS_HASHING_METHOD = 'content'
  
  # # See: http://django_compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_CSS_FILTERS
  # COMPRESS_CSS_FILTERS = [
  #     'compressor.filters.template.TemplateFilter',
  # ]
  
  # # See: http://django_compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_JS_FILTERS
  # COMPRESS_JS_FILTERS = [
  #     'compressor.filters.template.TemplateFilter',
  # ]
  ########## END COMPRESSION CONFIGURATION
  
  
  
  ########## CORS
  CORS_ORIGIN_ALLOW_ALL = True # If this is used then `CORS_ORIGIN_WHITELIST` will not have any effect
  CORS_ALLOW_CREDENTIALS = True
  CORS_ORIGIN_WHITELIST = [
      'http://localhost:3030',
  ] # If this is used, then not need to use `CORS_ORIGIN_ALLOW_ALL = True`
  CORS_ORIGIN_REGEX_WHITELIST = [
      'http://localhost:3030',
  ]
  ########## END CORS CONFIGURATION
  
  ########## EMAIL CONFIGURATION
  # See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
  # EMAIL_BACKEND = 'django_mailgun.MailgunBackend'
  # MAILGUN_ACCESS_KEY = 'key-c2ebfec48050f7c36bd1a9f8f59fd2e3'
  # MAILGUN_SERVER_NAME = 'mg.mappostcards.com'
  ########## END EMAIL CONFIGURATION
  
  
  # ########## SSL CONFIGURATION
  # 
  # Disable by load balancer
  # 
  # SESSION_COOKIE_SECURE = True
  # SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https')
  # CSRF_COOKIE_SECURE = True
  # ########## END SSL CONFIGURATION
  
  
  # ########## SITE CONFIGURATION
  # SITE_URL = "https://localhost"
  # ########## END SITE CONFIGURATION
  
  