text: """
  Django settings for core project.
  
  Generated by 'django-admin startproject' using Django 3.1.4.
  
  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/
  """
  
  import os
  from pathlib import Path
  
  # Build paths inside the project like this: BASE_DIR / 'subdir'.
  BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
  
  APPLICATION_NAME = os.environ.get('APPLICATION_NAME')
  
  ENVIRONMENT = os.environ.get('ENVIRONMENT')
  
  SECRET_KEY = os.environ.get('SECRET_KEY')
  
  DEBUG = int(os.environ.get('DEBUG'))
  
  ALLOWED_HOSTS = ['localhost', '127.0.0.1', ]
  
  # 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',  # for allauth
      # third party
      'rest_framework',
      'rest_framework.authtoken',
      'allauth',
      'allauth.account',
      'django_filters',
      'dj_rest_auth',
      'dj_rest_auth.registration',
      'admin_honeypot',
      'corsheaders',
      # local
      'users.apps.UsersConfig',
      'page_api.apps.PageApiConfig',
      # third party that is recommended to be in the end
      'django_cleanup.apps.CleanupConfig',
  ]
  
  MIDDLEWARE = [
      'django.middleware.security.SecurityMiddleware',
      'corsheaders.middleware.CorsMiddleware',  # corsheaders
      'whitenoise.middleware.WhiteNoiseMiddleware',  # whitenoise / for production
      '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 = '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'
  
  
  # Database
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql',
          'NAME': 'postgres',
          'USER': 'postgres',
          'PASSWORD': 'postgres',
          'HOST': 'db',  # docker-composeのservice
          'PORT': 5432
      }
  }
  
  
  # 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
  
  
  # custom user model configs
  AUTH_USER_MODEL = 'users.CustomUser'
  
  
  # Static files (CSS, JavaScript, Images)
  STATIC_URL = '/static/'
  STATICFILES_DIRS = [BASE_DIR / 'static', ]
  STATIC_ROOT = BASE_DIR / 'staticfiles'
  STATICFILES_FINDERS = [
      'django.contrib.staticfiles.finders.FileSystemFinder',
      'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  ]
  
  
  # media files
  if ENVIRONMENT == 'development':
      MEDIA_URL = f'{APPLICATION_NAME}/{ENVIRONMENT}/'
  else:
      MEDIA_URL = f'{APPLICATION_NAME}/'
  MEDIA_ROOT = BASE_DIR / 'media'
  
  
  from .configs import *
  
  
  # security configs
  if ENVIRONMENT == 'production':
      SECURE_BROWSER_XSS_FILTER = True
      X_FRAME_OPTIONS = 'DENY'
      SECURE_SSL_REDIRECT = True
      SECURE_HSTS_SECONDS = 3600
      SECURE_HSTS_INCLUDE_SUBDOMAINS = True
      SECURE_HSTS_PRELOAD = True
      SECURE_CONTENT_TYPE_NOSNIFF = True
      SESSION_COOKIE_SECURE = True
      CSRF_COOKIE_SECURE = True
      SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https',)
      EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  
  # Heroku
  import dj_database_url
  db_from_env = dj_database_url.config(conn_max_age=500)
  DATABASES['default'].update(db_from_env)
  