text: """
  Django settings for diaryapp project.
  
  Generated by 'django-admin startproject' using Django 3.1.1.
  
  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/
  """
  
  from pathlib import Path
  from datetime import timedelta
  try:
      import django_heroku
      django_heroku.settings(locals())
  except:
      pass
  
  import os
  import dj_database_url
  import dotenv
  
  # Build paths inside the project like this: BASE_DIR / 'subdir'.
  BASE_DIR = Path(__file__).resolve().parent.parent
  
  dotenv_file = BASE_DIR / ".env"
  if os.path.isfile(dotenv_file):
      dotenv.load_dotenv(dotenv_file)
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = os.environ['SECRET_KEY']
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True if os.environ['debug'].lower() == 'true' else False
  
  ALLOWED_HOSTS = ["*"]
  
  # 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',
  
      'diary.apps.DiaryConfig',
      'accounts.apps.AccountsConfig',
      'frontend.apps.FrontendConfig',
  
      'allauth',
      'allauth.account',
      'allauth.socialaccount',
      'allauth.socialaccount.providers.google',
      'allauth.socialaccount.providers.github',
      'allauth.socialaccount.providers.facebook',
  
      'rest_framework',
  ]
  
  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',
      'whitenoise.middleware.WhiteNoiseMiddleware',
  ]
  
  AUTHENTICATION_BACKENDS = (
      'django.contrib.auth.backends.ModelBackend',
      'allauth.account.auth_backends.AuthenticationBackend',
  )
  
  REST_FRAMEWORK = {
      'DEFAULT_PERMISSION_CLASSES': [
          'rest_framework.permissions.IsAuthenticated',
      ],
      'DEFAULT_AUTHENTICATION_CLASSES': (
          'rest_framework.authentication.SessionAuthentication',
          'rest_framework.authentication.BasicAuthentication',
          'rest_framework_simplejwt.authentication.JWTAuthentication',
      ),
  }
  
  SIMPLE_JWT = {
      'ACCESS_TOKEN_LIFETIME': timedelta(minutes=5),
      'REFRESH_TOKEN_LIFETIME': timedelta(days=14),
      'ROTATE_REFRESH_TOKENS': True,
      'BLACKLIST_AFTER_ROTATION': False,
      'ALGORITHM': 'HS256',
      'SIGNING_KEY': SECRET_KEY,
      'VERIFYING_KEY': None,
      'AUTH_HEADER_TYPES': ('Token',),
      'USER_ID_FIELD': 'id',
      'USER_ID_CLAIM': 'user_id',
      'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',),
      'TOKEN_TYPE_CLAIM': 'token_type',
  }
  
  SITE_ID = os.environ['SITE_ID']
  LOGIN_REDIRECT_URL = '/'
  
  REST_USE_JWT = True
  
  SOCIALACCOUNT_PROVIDERS = {
      'google': {
          'SCOPE': [
              'profile',
              'email',
          ],
          'AUTH_PARAMS': {
              'access_type': 'online',
          }
      },
      'github': {
          'SCOPE': [
              'user',
              'repo',
              'read:org',
          ],
      },
      'facebook': {
          'METHOD': 'oauth2',
          'SDK_URL': '//connect.facebook.net/{locale}/sdk.js',
          'SCOPE': ['email', 'public_profile'],
          'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
          'INIT_PARAMS': {'cookie': True},
          'FIELDS': [
              'id',
              'first_name',
              'last_name',
              'middle_name',
              'name',
              'name_format',
              'picture',
              'short_name'
          ],
          'EXCHANGE_TOKEN': True,
          'LOCALE_FUNC': 'path.to.callable',
          'VERIFIED_EMAIL': False,
          'VERSION': 'v7.0',
      }
  }
  
  ROOT_URLCONF = 'diaryapp.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [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 = 'diaryapp.wsgi.application'
  
  
  # Database
  # https://docs.djangoproject.com/en/3.1/ref/settings/#databases
  
  # DATABASES = {
  #     'default': {
  #         'ENGINE': 'django.db.backends.sqlite3',
  #         'NAME': BASE_DIR / 'db.sqlite3',
  #     }
  # }
  DATABASES = {}
  DATABASES['default'] = dj_database_url.config(conn_max_age=600)
  
  STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
  
  options = DATABASES['default'].get('OPTIONS', {})
  options.pop('sslmode', None)
  
  # 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 = 'Asia/Calcutta'
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/3.1/howto/static-files/
  
  
  STATIC_URL = '/static/'
  
  STATIC_ROOT = BASE_DIR / "staticfiles"
  
  STATICFILES_DIRS = (
      BASE_DIR / "static",
      BASE_DIR / 'frontend' / 'src' / 'assets',
  )
  