text: """
  Django settings for the auction project.
  
  For more information on this file, see
  https://docs.djangoproject.com/en/2.1/topics/settings/
  
  For the full list of settings and their values, see
  https://docs.djangoproject.com/en/2.1/ref/settings/
  """
  
  import os
  
  import environ
  
  MANAGEPY_DIR = (
      environ.Path(__file__) - 2
  )  # (backend/auction/settings.py - 2 = backend/)
  BASE_DIR = environ.Path(__file__) - 1  # (auction/settings.py - 1 = auction/)
  
  FILES_DIR = MANAGEPY_DIR.path("files")
  
  
  # Security =====================================================================
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = "g1m+dgrwkpablx39wf7p^d9j7%w_ms0%49!4zy1u+1y6j=d@l6"
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True
  
  ALLOWED_HOSTS = ["localhost", "auksjonsbua-backend.herokuapp.com"]
  
  # Application definition =======================================================
  
  DJANGO_APPS = [
      "django.contrib.sites",
      "django.contrib.admin",
      "django.contrib.auth",
      "django.contrib.contenttypes",
      "django.contrib.sessions",
      "django.contrib.messages",
      "django.contrib.staticfiles",
  ]
  
  
  THIRD_PARTY_APPS = [
      "corsheaders",
      "django_extensions",
      "debug_toolbar",
      "rest_framework",
      "rest_framework.authtoken",
      "allauth",
      "allauth.account",
      "allauth.socialaccount",
      "rest_auth",
      "rest_auth.registration",
  ]
  
  
  LOCAL_APPS = ["auction.users", "auction.auctions", "auction.reports"]
  
  INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
  
  # Middleware ==================================================================
  
  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",
      "debug_toolbar.middleware.DebugToolbarMiddleware",
      "corsheaders.middleware.CorsMiddleware",
      "whitenoise.middleware.WhiteNoiseMiddleware",
  ]
  
  # Django REST Framework ========================================================
  
  REST_FRAMEWORK = {
      # Use Django's standard `django.contrib.auth` permissions,
      # or allow read-only access for unauthenticated users.
      "DEFAULT_PERMISSION_CLASSES": [
          "rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly",
          # "rest_framework.permissions.AllowAny"
      ],
      "DEFAULT_AUTHENTICATION_CLASSES": (
          "rest_framework.authentication.TokenAuthentication",
          "rest_framework.authentication.SessionAuthentication",
      ),
      "DEFAULT_PARSER_CLASSES": (
          "rest_framework.parsers.JSONParser",
          "rest_framework.parsers.MultiPartParser",
          "rest_framework.parsers.FileUploadParser",
          "rest_framework.parsers.FormParser",
      ),
  }
  
  REST_AUTH_REGISTER_SERIALIZERS = {
      "REGISTER_SERIALIZER": "auction.users.serializers.UserRegisterSerializer"
  }
  
  # Templates ====================================================================
  
  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",
              ]
          },
      }
  ]
  
  
  # Database  ====================================================================
  # https://docs.djangoproject.com/en/2.1/ref/settings/#databases
  
  DATABASES = {
      "default": {
          "ENGINE": "django.db.backends.sqlite3",
          "NAME": MANAGEPY_DIR.path("db.sqlite3")(),
      }
  }
  
  if os.environ.get("PRODUCTION"):
      import dj_database_url
  
      DATABASES["default"] = dj_database_url.parse(
          os.environ["DATABASE_URL"], conn_max_age=600
      )
  
  
  # Authentication ================================================================
  # https://docs.djangoproject.com/en/2.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"},
  ]
  
  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",
  ]
  
  
  # Internationalization ==========================================================
  # https://docs.djangoproject.com/en/2.1/topics/i18n/
  
  LANGUAGE_CODE = "en-us"
  TIME_ZONE = "UTC"
  USE_I18N = True
  USE_L10N = True
  USE_TZ = True
  
  
  # Static files & Media  =========================================================
  # Static files (CSS, JavaScript, Images), https://docs.djangoproject.com/en/2.1/howto/static-files/
  
  STATIC_ROOT = FILES_DIR.path("static")()
  STATIC_URL = "/static/"
  
  MEDIA_ROOT = FILES_DIR.path("media")()
  MEDIA_URL = "/media/"
  
  
  # Misc. ==========================================================================
  WSGI_APPLICATION = "auction.wsgi.application"
  ROOT_URLCONF = "auction.urls"
  
  DEBUG_TOOLBAR_PANELS = [
      "debug_toolbar.panels.versions.VersionsPanel",
      "debug_toolbar.panels.timer.TimerPanel",
      "debug_toolbar.panels.settings.SettingsPanel",
      "debug_toolbar.panels.headers.HeadersPanel",
      "debug_toolbar.panels.request.RequestPanel",
      "debug_toolbar.panels.sql.SQLPanel",
      "debug_toolbar.panels.templates.TemplatesPanel",
      "debug_toolbar.panels.cache.CachePanel",
      "debug_toolbar.panels.signals.SignalsPanel",
      "debug_toolbar.panels.logging.LoggingPanel",
      "debug_toolbar.panels.redirects.RedirectsPanel",
  ]
  
  
  SITE_ID = 1
  
  INTERNAL_IPS = ["127.0.0.1"]
  CORS_ALLOW_CREDENTIALS = True
  
  CORS_ORIGIN_WHITELIST = [
      "127.0.0.1:3000",
      "localhost:3000",
      "localhost:8000",
      "127.0.0.1:8000",
  ]
  
  CORS_ORIGIN_ALLOW_ALL = True
  ACCOUNT_EMAIL_VERIFICATION = "none"
  ACCOUNT_AUTHENTICATION_METHOD = "username"
  ACCOUNT_EMAIL_REQUIRED = False
  
  LOGIN_REDIRECT = "/"
  
  # Simplified static file serving.
  # https://warehouse.python.org/project/whitenoise/
  
  STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
  
  if "HEROKU" in os.environ:
      # Configure Django App for Heroku.
      import django_heroku
  
      django_heroku.settings(locals())
  