text: """
  Django settings for karaokeapp project.
  
  Generated by 'django-admin startproject' using Django 3.2.5.
  
  For more information on this file, see
  https://docs.djangoproject.com/en/3.2/topics/settings/
  
  For the full list of settings and their values, see
  https://docs.djangoproject.com/en/3.2/ref/settings/
  """
  
  from dotenv import load_dotenv
  from pathlib import Path
  import os
  
  load_dotenv()
  
  # 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.2/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = os.getenv("SECRET_KEY")
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True if os.getenv("DEBUG") else False
  print("DEBUG VALUE:", DEBUG)
  
  USE_DATABASE = "MONGO" if DEBUG is False else "TEST"
  print("USE_DATABASE:", USE_DATABASE)
  
  ALLOWED_HOSTS = [] if DEBUG is True else ["musicappjtv.herokuapp.com"]
  
  
  # Application definition
  
  INSTALLED_APPS = [
      "django.contrib.admin",
      "django.contrib.auth",
      "django.contrib.contenttypes",
      "django.contrib.sessions",
      "django.contrib.messages",
      "django.contrib.staticfiles",
      "mainapp.apps.MainappConfig",
      "userprofile.apps.UserprofileConfig",
      "authentication.apps.AuthenticationConfig",
      "admins.apps.AdminsConfig",
      "rest_framework",
      "corsheaders",
      "storages",
      "django_extensions",
  ]
  
  MIDDLEWARE = [
      "django.middleware.security.SecurityMiddleware",
      "django.contrib.sessions.middleware.SessionMiddleware",
      "corsheaders.middleware.CorsMiddleware",
      "django.middleware.common.CommonMiddleware",
      "django.middleware.csrf.CsrfViewMiddleware",
      "django.contrib.auth.middleware.AuthenticationMiddleware",
      "django.contrib.messages.middleware.MessageMiddleware",
      "django.middleware.clickjacking.XFrameOptionsMiddleware",
  ]
  
  CORS_ALLOWED_ORIGINS = [
      "http://localhost:3000",
      "http://localhost:5000",
      "http://localhost:8000",
  ]
  
  
  CORS_ORIGIN_ALLOW_ALL = True
  
  ROOT_URLCONF = "core.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 = "core.wsgi.application"
  
  if DEBUG:
      print("THROTTLE RATE: DEVELOPMENT")
      REST_FRAMEWORK = {
          "DEFAULT_THROTTLE_CLASSES": [
              "rest_framework.throttling.AnonRateThrottle",
          ],
          "DEFAULT_THROTTLE_RATES": {
              "init_throttle": "10/min",
              "anon": "10/min",
          },
          "DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",),
          "DEFAULT_SCHEMA_CLASS": "rest_framework.schemas.coreapi.AutoSchema",
          "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
          "PAGE_SIZE": 10,
      }
  
  else:
      print("THROTTLE RATE: DEPLOYMENT")
      REST_FRAMEWORK = {
          "DEFAULT_THROTTLE_CLASSES": [
              "rest_framework.throttling.AnonRateThrottle",
          ],
          "DEFAULT_THROTTLE_RATES": {
              "init_throttle": "1000/min",
              "anon": "10/min",
          },
          "DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",),
          "DEFAULT_SCHEMA_CLASS": "rest_framework.schemas.coreapi.AutoSchema",
          "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
          "PAGE_SIZE": 10,
      }
  
  if DEBUG:
      CACHES = {
          "default": {
              "BACKEND": "django_redis.cache.RedisCache",
              "LOCATION": "redis://127.0.0.1:8058/1",
              "OPTIONS": {
                  "CLIENT_CLASS": "django_redis.client.DefaultClient",
              },
          }
      }
  
  # if DEBUG:
  #     CACHES = {
  #         "default": {
  #             "BACKEND": "django.core.cache.backends.dummy.DummyCache",
  #         }
  #     }
  else:
      print("Deployment Does Not Support Caching")
  
  SESSION_ENGINE = "django.contrib.sessions.backends.cache"
  
  # Database
  # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
  
  if USE_DATABASE == "MONGO":
      DATABASE = {"mongo_uri": os.getenv("MONGO_URI"), "db": os.getenv("MONGO_DB")}
      AWS_BUCKET_FOLDER = os.getenv("BUCKET_SUBFOLDER")
  
  elif USE_DATABASE == "TEST":
      DATABASE = {
          "mongo_uri": os.getenv("TEST_MONGO_URI"),
          "db": os.getenv("TEST_MONGO_DB"),
      }
      AWS_BUCKET_FOLDER = os.getenv("TEST_BUCKET_SUBFOLDER")
  
  print("USING DB: ", DATABASE["db"])
  
  # Password validation
  # https://docs.djangoproject.com/en/3.2/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.2/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.2/howto/static-files/
  
  STATIC_URL = "/static/"
  STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
  
  MEDIA_URL = "/media/"
  MEDIA_ROOT = os.path.join(BASE_DIR, "media")
  
  # Default primary key field type
  # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
  
  DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
  
  DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
  
  if DEBUG:
      AWS_ACCESS_KEY_ID = os.environ.get("TEST_AWS_ACCESS_KEY_ID")
      AWS_SECRET_ACCESS_KEY = os.environ.get("TEST_AWS_SECRET_ACCESS_KEY")
      AWS_STORAGE_BUCKET_NAME = os.environ.get("TEST_AWS_STORAGE_BUCKET_NAME")
      AWS_OBJECT_URL_PREFIX = os.getenv("TEST_AWS_S3_OBJECT_URL_PREFIX")
  else:
      AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID")
      AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY")
      AWS_STORAGE_BUCKET_NAME = os.environ.get("AWS_STORAGE_BUCKET_NAME")
      AWS_OBJECT_URL_PREFIX = os.getenv("AWS_S3_OBJECT_URL_PREFIX")
  
  AWS_QUERYSTRING_AUTH = False
  AWS_S3_FILE_OVERWRITE = False
  AWS_DEFAULT_ACL = None
  