text: """
  Django settings for IMnight project.
  
  Generated by 'django-admin startproject' using Django 1.11.5.
  
  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
  
  # 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 = 'ti#_4flcu1o_%!)rxqvujigi5=1=kl!9k9f(m^r1-+q8m+v*ub'
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True
  
  ALLOWED_HOSTS = []
  
  
  # Application definition
  
  INSTALLED_APPS = [
      'jet.dashboard',
      'jet',
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  
  
      'corsheaders',
  
  
      'channels',
  
      # django REST framework
      # http://www.django-rest-framework.org
      'rest_framework',
      'rest_framework.authtoken',
  
      'rest_framework_swagger',
  
      # http://django-rest-auth.readthedocs.io/en/latest/index.html
      'django.contrib.sites',
      'allauth',
      'allauth.account',
  
      'rest_auth',
      'rest_auth.registration',
  
      'allauth.socialaccount',
      'allauth.socialaccount.providers.facebook',
  
      # self create apps
      'accounts',
      'human',
      'earth',
      'sky',
      'lottery',
  ]
  
  SITE_ID = 1
  
  MIDDLEWARE = [
      'django.middleware.security.SecurityMiddleware',
      'whitenoise.middleware.WhiteNoiseMiddleware',
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'corsheaders.middleware.CorsPostCsrfMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
  
      'corsheaders.middleware.CorsMiddleware',
      'django.middleware.common.CommonMiddleware',
  ]
  
  ROOT_URLCONF = 'IMnight.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [
              os.path.join(BASE_DIR, 'human/template'),
          ],
          '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 = 'IMnight.wsgi.application'
  ASGI_APPLICATION = "IMnight.routing.application"
  
  LOGIN_REDIRECT_URL = '/'
  
  ACCOUNT_ADAPTER = 'accounts.social.adapter.MyAccountAdapter'
  
  SOCIALACCOUNT_ADAPTER = 'accounts.social.adapter.MySocialAccountAdapter'
  
  ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
  
  AUTHENTICATION_BACKENDS = (
      # Needed to login by username in Django admin, regardless of `allauth`
      'django.contrib.auth.backends.ModelBackend',
  
      # `allauth` specific authentication methods, such as login by e-mail
      'allauth.account.auth_backends.AuthenticationBackend',
  )
  
  SOCIALACCOUNT_PROVIDERS = {
      'facebook': {
          'METHOD': 'oauth2',
          'SCOPE': ['email', 'public_profile', 'user_friends'],
          'AUTH_PARAMS': {},
          'INIT_PARAMS': {'cookie': True},
          'FIELDS': [
              'id',
              'email',
              'name',
              'first_name',
              'last_name',
              'verified',
              'locale',
              'timezone',
              'link',
          ],
          'EXCHANGE_TOKEN': True,
          'LOCALE_FUNC': lambda request: 'en_US',
          'VERIFIED_EMAIL': False,
          'VERSION': 'v2.10',
      }
  }
  
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql',
          'NAME': 'hotfix',
          'USER': 'django',
          'PASSWORD': 'bnjaAKWULde^22=9$!fq',
          'HOST': '140.112.106.45',
          'PORT': '5432',
      }
  }
  
  # 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 = 'Asia/Taipei'
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  
  # django REST framework
  # http://www.django-rest-framework.org
  
  REST_FRAMEWORK = {
      'DEFAULT_AUTHENTICATION_CLASSES': (
          'rest_framework.authentication.BasicAuthentication',
          'rest_framework.authentication.SessionAuthentication',
      ),
      'DEFAULT_PERMISSION_CLASSES': (
          'rest_framework.permissions.AllowAny',
      )
  }
  
  ACCOUNT_EMAIL_VERIFICATION = 'none'
  ACCOUNT_UNIQUE_EMAIL = False
  
  EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  # TLS Port
  EMAIL_PORT = 587
  EMAIL_USE_TLS = True
  EMAIL_HOST = 'smtp.gmail.com'
  # EMAIL_HOST_USER = ''
  # Application Key
  # EMAIL_HOST_PASSWORD = ''
  
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/1.11/howto/static-files/
  
  STATIC_URL = '/static/IMnight/'
  STATIC_ROOT = os.path.join(BASE_DIR, 'static')
  STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
  
  # Channel for chat
  # https://blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django
  redis_host = os.environ.get('REDIS_HOST', 'localhost')
  
  # CHANNEL_LAYERS = {
  #     "default": {
  #         "BACKEND": "channels_redis.core.RedisChannelLayer",
  #         "CONFIG": {
  #             "hosts": [os.environ.get('REDIS_URL', 'redis://140.112.106.45:6379')],
  #         },
  #         # "ROUTING": "IMnight.asgi:application",
  #     },
  # }
  
  CHANNEL_LAYERS = {
      "default": {
          "BACKEND": "channels_redis.core.RedisChannelLayer",
          "CONFIG": {
              "hosts": [os.environ.get('REDIS_URL', 'redis://140.112.106.45:6379')],
          },
      },
  }
  
  # Logger
  # https://www.webforefront.com/django/setupdjangologging.html
  LOGGING = {
      'version': 1,
      'disable_existing_loggers': False,
      'formatters': {
          'verbose': {
              'format': '%(levelname)s - [%(asctime)s] (%(module)s %(process)d %(thread)d) %(message)s',
              'datefmt': '%Y-%m-%d %H:%M:%S'
          },
          'simple': {
              'format': '%(levelname)s - [%(asctime)s] %(message)s',
              'datefmt': '%Y-%m-%d %H:%M:%S'
          },
      },
      'handlers': {
          'console': {
              'class': 'logging.StreamHandler',
              'formatter': 'simple'
          },
          'file': {
              'level': 'INFO',
              'class': 'logging.FileHandler',
              'filename': 'debug.log',
              'formatter': 'verbose'
          },
      },
      'loggers': {
          'syslogger': {
              'handlers': ['console', 'file'],
          },
      },
  }
  