text: from pathlib import Path
  import os
  
  # Build paths inside the project like this: BASE_DIR / 'subdir'.
  BASE_DIR = Path(__file__).resolve().parent.parent
  run_type = os.getenv("RUN_TYPE")
  
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = 'django-insecure-5#^-f9qpf_)qo(^x&m#&xvq@8h5rj32c!xj6(g(s3^&i@q+kqs'
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True
  
  CORS_ORIGIN_ALLOW_ALL = True
  ALLOWED_HOSTS = ['*']
  
  
  # Application definition
  
  INSTALLED_APPS = [
      # Django's default apps
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  
      # Third party frameworks
      'rest_framework',
      'rest_framework.authtoken',
      'behave_django',
      'corsheaders',
      'channels',
  
      # Custom apps
      'user_mgmt.apps.UserMgmtConfig',
      'host.apps.HostConfig',
      'walk.apps.WalkConfig',
  ]
  
  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',
      'corsheaders.middleware.CorsMiddleware'
  ]
  
  REST_FRAMEWORK = {
      'DEFAULT_AUTHENTICATION_CLASSES': ['rest_framework.authentication.TokenAuthentication',],
      'DEFAULT_PERMISSION_CLASSES': ['rest_framework.permissions.IsAuthenticated',],
  }
  
  ROOT_URLCONF = 'privilege_walk_be.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 = 'privilege_walk_be.wsgi.application'
  
  ASGI_APPLICATION = 'privilege_walk_be.asgi.application'
  
  
  if run_type == "aws":
      print("running on AWS")
      CHANNEL_LAYERS = {
          'default': {
              'BACKEND': 'channels_redis.core.RedisChannelLayer',
              'CONFIG': {
                  "hosts": [('localhost', 6379)],
              },
          },
      }
  
  elif run_type == "docker_compose":
      print("Running on Docker Compose")
      CHANNEL_LAYERS = {
          'default': {
              'BACKEND': 'channels_redis.core.RedisChannelLayer',
              'CONFIG': {
                  "hosts": [('cache', 6379)],
              },
          },
      }
  
  else:
      print('running normally')
      CHANNEL_LAYERS = {
          'default': {
              'BACKEND': 'channels.layers.InMemoryChannelLayer'
          }
      }
  
  
  # Database
  # https://docs.djangoproject.com/en/4.0/ref/settings/#databases
  
  # Heroku deployment database
  if run_type == "heroku":
      DATABASES = {
          'default': {
              'ENGINE': 'django.db.backends.postgresql_psycopg2',
              'NAME': os.getenv("DB_NAME"),
              'USER': os.getenv("DB_USERNAME"),
              'PASSWORD': os.getenv("DB_PASSWORD"),
              'HOST': os.getenv("DATABASE_HOST"),
              'PORT': os.getenv("DB_PORT"),
          }
      }
  
  elif run_type == "aws":
      print("running on AWS")
      DATABASES = {
          'default': {
              'ENGINE': 'django.db.backends.postgresql_psycopg2',
              'NAME': "postgres",
              'USER': "postgres",
              'PASSWORD': "postgres",
              'HOST': "localhost",
              'PORT': "5432",
          }
      }
  
  elif run_type == "docker_compose":
      print("Running on Docker Compose")
      DATABASES = {
          'default': {
              'ENGINE': 'django.db.backends.postgresql',
              'NAME': os.environ.get('POSTGRES_NAME'),
              'USER': os.environ.get('POSTGRES_USER'),
              'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
              'HOST': 'db',
              'PORT': 5432,
          }
      }
  
  # Local test database
  else:
      DATABASES = {
          'default': {
              'ENGINE': 'django.db.backends.sqlite3',
              'NAME': BASE_DIR / 'db.sqlite3',
          }
      }
  
  
  # Password validation
  # https://docs.djangoproject.com/en/4.0/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/4.0/topics/i18n/
  
  LANGUAGE_CODE = 'en-us'
  
  TIME_ZONE = 'UTC'
  
  USE_I18N = True
  
  USE_TZ = True
  
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/4.0/howto/static-files/
  
  STATIC_URL = '/staticfiles/'
  STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
  STATICFILES_DIRS = [
      os.path.join(BASE_DIR, 'static')
  ]
  # Default primary key field type
  # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
  
  DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  