text: import os
  
  # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  
  ENVIRONMENT = os.environ.get('ENVIRONMENT', default='production')
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/2.2/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 = int(os.environ.get('DEBUG', default=0))
  
  ALLOWED_HOSTS = ['.herokuapp.com', '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',
  
      # Third-party
      'crispy_forms',
      'allauth',
      'allauth.account',
      'debug_toolbar',
  
      # Local
      'users.apps.UsersConfig',
      'pages.apps.PagesConfig',
      'books.apps.BooksConfig',
      'orders.apps.OrdersConfig',
  ]
  
  MIDDLEWARE = [
      'django.middleware.cache.UpdateCacheMiddleware',
      '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',
      'django.middleware.cache.FetchFromCacheMiddleware',
  ]
  
  CACHE_MIDDLEWARE_ALIAS = 'default'
  CACHE_MIDDLEWARE_SECONDS = 604800
  CACHE_MIDDLEWARE_KEY_PREFIX = ''
  
  ROOT_URLCONF = 'bookstore_project.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [os.path.join(BASE_DIR, 'templates')],
          '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 = 'bookstore_project.wsgi.application'
  
  
  # Database
  # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql',
          'NAME': 'postgres',
          'USER': 'postgres',
          'PASSWORD': 'postgres',
          'HOST': 'db',
          'PORT': 5432
      }
  }
  
  
  # Password validation
  # https://docs.djangoproject.com/en/2.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/2.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/2.2/howto/static-files/
  
  STATIC_URL = '/static/'
  STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'),]
  STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
  STATICFILES_FINDERS = [
      "django.contrib.staticfiles.finders.FileSystemFinder",
      "django.contrib.staticfiles.finders.AppDirectoriesFinder",
  ]
  
  MEDIA_URL = '/media/'
  MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  
  AUTH_USER_MODEL = 'users.CustomUser'
  
  # django-crispy-forms
  CRISPY_TEMPLATE_PACK = 'bootstrap4'
  
  # django-allauth config
  LOGIN_REDIRECT_URL = 'home'
  ACCOUNT_LOGOUT_REDIRECT = 'home'
  
  SITE_ID = 1
  
  AUTHENTICATION_BACKENDS = (
      'django.contrib.auth.backends.ModelBackend',
      'allauth.account.auth_backends.AuthenticationBackend',
  )
  
  EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  EMAIL_HOST=os.environ.get('EMAIL_HOST')
  EMAIL_HOST_USER=os.environ.get('EMAIL_HOST_USER')
  EMAIL_HOST_PASSWORD=os.environ.get('EMAIL_HOST_PASSWORD')
  EMAIL_PORT=os.environ.get('EMAIL_PORT')
  EMAIL_USE_TLS=os.environ.get('EMAIL_USE_TLS')
  
  ACCOUNT_SESSION_REMEMBER = True
  ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE = False
  ACCOUNT_USERNAME_REQUIRED = False
  ACCOUNT_AUTHENTICATION_METHOD = 'email'
  ACCOUNT_EMAIL_REQUIRED = True
  ACCOUNT_UNIQUE_EMAIL = True
  
  DEFAULT_FROM_EMAIL = 'admin@djangobookstore.com'
  
  STRIPE_TEST_PUBLISHABLE_KEY=os.environ.get('STRIPE_TEST_PUBLISHABLE_KEY')
  STRIPE_TEST_SECRET_KEY=os.environ.get('STRIPE_TEST_SECRET_KEY')
  
  # django-debug-toolbar
  import socket
  hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
  INTERNAL_IPS = [ip[:-1] + "1" for ip in ips]
  
  # production
  if ENVIRONMENT == 'production':
      SECURE_SSL_REDIRECT = True
      SECURE_HSTS_SECONDS = 2592000
      SECURE_HSTS_INCLUDE_SUBDOMAINS = True
      SECURE_HSTS_PRELOAD = True
      SECURE_CONTENT_TYPE_NOSNIFF = True
      SESSION_COOKIE_SECURE = True
      CSRF_COOKIE_SECURE = True
  