text: """
  Django settings for velvet_goldmine project.
  
  Generated by 'django-admin startproject' using Django 3.1.7.
  
  For more information on this file, see
  https://docs.djangoproject.com/en/3.1/topics/settings/
  
  For the full list of settings and their values, see
  https://docs.djangoproject.com/en/3.1/ref/settings/
  """
  
  from pathlib import Path
  import os
  import dj_database_url
  
  
  # Build paths inside the project like this: BASE_DIR / 'subdir'.
  BASE_DIR = Path(__file__).resolve().parent.parent
  
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = os.environ.get('SECRET_KEY', '')
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = 'DEVELOPMENT' in os.environ
  
  
  ALLOWED_HOSTS = ['the-velvet-goldmine.herokuapp.com', 'localhost']
  
  
  # Application definition
  
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'django.contrib.sites',
      'allauth',
      'allauth.account',
      'allauth.socialaccount',
      'allauth.socialaccount.providers.facebook',
      'allauth.socialaccount.providers.google',
      'home',
      'products',
      'bag',
      'checkout',
      'contact',
      'profiles',
      'blog',
      'crispy_forms',
      'storages',
      'django_extensions',
  ]
  
  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',
  ]
  
  ROOT_URLCONF = 'velvet_goldmine.urls'
  
  CRISPY_TEMPLATE_PACK = 'bootstrap4'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [
              os.path.join(BASE_DIR, 'templates'),
              os.path.join(BASE_DIR, 'templates', 'allauth'),
          ],
          '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',
                  'django.template.context_processors.media',
                  'bag.contexts.bag_contents',
                  'contact.contexts.newsletter_subscription_form',
                  'products.contexts.rand_product_list',
              ],
              'builtins': [
                  'crispy_forms.templatetags.crispy_forms_tags',
                  'crispy_forms.templatetags.crispy_forms_field',
              ],
          },
      },
  ]
  
  MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
  
  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',
  ]
  
  SITE_ID = 1
  
  ACCOUNT_AUTHENTICATION_METHOD = 'username_email'
  ACCOUNT_EMAIL_REQUIRED = True
  ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
  ACCOUNT_SIGNUP_EMAIL_ENTER_TWICE = True
  ACCOUNT_USERNAME_MIN_LENGTH = 4
  LOGIN_URL = '/accounts/login/'
  LOGIN_REDIRECT_URL = '/'
  
  SOCIALACCOUNT_PROVIDERS = {
      'google': {
          'SCOPE': [
              'profile',
              'email',
          ],
          'AUTH_PARAMS': {
              'access_type': 'online',
          }
      },
      'facebook': {
          'METHOD': 'oauth2',
          'SCOPE': [
              'email',
              'public_profile',
              'user_friends'
          ],
          'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
          'FIELDS': [
              'id',
              'email',
              'name',
              'first_name',
              'last_name',
              'verified',
              'locale',
              'timezone',
              'link',
              'gender',
              'updated_time'
          ],
          'EXCHANGE_TOKEN': True,
          'LOCALE_FUNC': lambda request: 'kr_KR',
          'VERIFIED_EMAIL': False,
          'VERSION': 'v2.4'
      }
  }
  
  WSGI_APPLICATION = 'velvet_goldmine.wsgi.application'
  
  
  GRAPH_MODELS = {
      'all_applications': False,
      'group_models': True,
      'app_labels': ["products", "checkout", "blog", "contact", "profiles"],
  }
  
  
  # Database
  # https://docs.djangoproject.com/en/3.1/ref/settings/#databases
  
  
  if 'DATABASE_URL' in os.environ:
      DATABASES = {
          'default': dj_database_url.parse(os.environ.get('DATABASE_URL'))
      }
  else:
      DATABASES = {
          'default': {
              'ENGINE': 'django.db.backends.sqlite3',
              'NAME': BASE_DIR / 'db.sqlite3',
          }
      }
  
  
  # Password validation
  # https://docs.djangoproject.com/en/3.1/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/3.1/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/3.1/howto/static-files/
  
  STATIC_URL = '/static/'
  STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
  
  MEDIA_URL = '/media/'
  MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  
  if 'USE_AWS' in os.environ:
      # Cache Control
      AWS_S3_OBJECT_PARAMETERS = {
          'Expires': 'Thu, 31 Dec 2099 20:00:00 GMT',
          'CacheControl': 'max-age=94608000',
      }
  
      # Bucket Config
      AWS_STORAGE_BUCKET_NAME = 'the-velvet-goldmine'
      AWS_S3_REGION_NAME = 'eu-west-1'
      AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
      AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
      AWS_S3_CUSTOM_DOMAIN = f'{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com'
  
      # Static and media files
      STATICFILES_STORAGE = 'custom_storages.StaticStorage'
      STATICFILES_LOCATION = 'static'
      DEFAULT_FILE_STORAGE = 'custom_storages.MediaStorage'
      MEDIAFILES_LOCATION = 'media'
  
      # Override static and media URLs in production
      STATIC_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/{STATICFILES_LOCATION}/'
      MEDIA_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/{MEDIAFILES_LOCATION}/'
  
  
  FREE_DELIVERY_THRESHOLD = 50
  STANDARD_DELIVERY_PERCENTAGE = 10
  STRIPE_CURRENCY = 'eur'
  STRIPE_PUBLIC_KEY = os.getenv('STRIPE_PUBLIC_KEY', '')
  STRIPE_SECRET_KEY = os.getenv('STRIPE_SECRET_KEY', '')
  STRIPE_WH_SECRET = os.getenv('STRIPE_WH_SECRET', '')
  
  if 'DEVELOPMENT' in os.environ:
      EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
      DEFAULT_FROM_EMAIL = 'thevelvetgoldmine@example.com'
  else:
      EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
      EMAIL_USE_TLS = True
      EMAIL_PORT = 587
      EMAIL_HOST = 'smtp.gmail.com'
      EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER')
      EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASS')
      DEFAULT_FROM_EMAIL = os.environ.get('EMAIL_HOST_USER')
  