text: """
  Django settings for django_etl project.
  
  Generated by 'django-admin startproject' using Django 3.1.3.
  
  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
  import os.path  # do not import os
  import socket  # allow server ip automatically
  import configparser  # https://docs.python.org/3/library/configparser.html
  
  # python manage.py check --deploy -> check security issues before publish
  # python manage.py collectstatic -> auto collect static file from app
  
  # Build paths inside the project like this: BASE_DIR / 'subdir'.
  BASE_DIR = Path(__file__).resolve().parent.parent
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
  
  # allow server IP
  ALLOWED_HOSTS = ['127.0.0.1', socket.gethostbyname(socket.getfqdn())]
  
  # allow designated server domain name
  # s_domain_name_txt = os.path.join(BASE_DIR, 'domain_names.txt')
  s_domain_name_txt = os.path.join(BASE_DIR, 'svconf', 'allowed_domain_names.txt')
  if os.path.isfile(s_domain_name_txt):
      with open(s_domain_name_txt) as f:
          s_domain_names = f.read().strip()
      lst_domain_name = s_domain_names.splitlines()
      for s_domain_name in lst_domain_name:
          ALLOWED_HOSTS.append(s_domain_name)
  
  # SECURITY WARNING: keep the secret key used in production secret!
  o_basic_config = configparser.RawConfigParser()  # make python3 config parser parse key case sensitive
  o_basic_config.optionxform = lambda option: option  # make python3 config parser parse key case sensitive
  s_basic_config_file = os.path.join(BASE_DIR, 'svconf', 'basic_config.ini')
  with open(s_basic_config_file) as f:
      o_basic_config.read_file(f)
  o_basic_config.read(s_basic_config_file)
  
  #with open(os.path.join(BASE_DIR, 'svcommon', 'secret_key.txt')) as f:
  # with open(os.path.join(BASE_DIR, 'svconf', 'django_secret_key.txt')) as f:
  #    SECRET_KEY = f.read().strip()
  SECRET_KEY = o_basic_config['DJANGO_SERVER']['secret_key']
  
  # SECURITY WARNING: don't run with debug turned on in production!
  # https://senticoding.tistory.com/82  how to deal with static and media if debug=False
  DEBUG = True
  
  # Application definition
  
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'widget_tweaks',  # for login template
      'crispy_forms',  # for bundle upload form
      'svtransform.apps.SvtransformConfig',
      'svload.apps.SvloadConfig',
      'svauth',  # for user model customization
      'svacct',
      'svextract.apps.SvextractConfig',
      'django.contrib.humanize',  # for number formatter on template
  ]
  
  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',
  ]
  
  ROOT_URLCONF = 'svcommon.urls'  # django_etl
  
  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 = 'svcommon.wsgi.application'  # django_etl
  
  
  # Database
  # https://docs.djangoproject.com/en/3.1/ref/settings/#databases
  
  DATABASES = {
      'default': {
          # 'ENGINE': 'django.db.backends.sqlite3',
          # 'NAME': BASE_DIR / 'db.sqlite3',
          'ENGINE': 'django.db.backends.mysql',
          'CONN_MAX_AGE': 3600,  # https://stackoverflow.com/questions/26958592/django-after-upgrade-mysql-server-has-gone-away
          'NAME': o_basic_config['DB_SERVER']['db_database'],
          'USER': o_basic_config['DB_SERVER']['db_userid'],
          'PASSWORD': o_basic_config['DB_SERVER']['db_password'],
          'HOST': o_basic_config['DB_SERVER']['db_hostname'],
          'PORT': o_basic_config['DB_SERVER']['db_port'],
          'OPTIONS': {
              'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
          },
      }
  }
  
  # 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',
      },
  ]
  
  AUTH_USER_MODEL = 'svauth.User'
  
  # to prevent WARNINGS on Django >= 3.2
  # Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
  # https://uiandwe.tistory.com/1304
  DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
  
  # Internationalization
  # https://docs.djangoproject.com/en/3.1/topics/i18n/
  LANGUAGE_CODE = 'ko-kr'
  TIME_ZONE = 'Asia/Seoul'
  USE_I18N = True
  USE_L10N = True
  USE_TZ = True
  
  # loogger setup
  LOGGING_CONFIG = 'logging.config.dictConfig'
  LOGGING = {
      'version': 1,
      'disable_existing_logger': False,
      'formatters': {
          'verbose': {
              'format': "[%(asctime)s %(levelname)s [%(name)s:%(lineno)s %(message)s",
              'datefmt': "%d/%b/%Y %H:%M:%S"
          },
      },
      'handlers': {
          'console': {
              'class': 'logging.StreamHandler',
          },
          'file_svtransform': {
              'level': 'DEBUG',
              'class': 'logging.FileHandler',
              'filename': os.path.join(BASE_DIR, 'logs', 'debug_svtransform.log'),
              'formatter': 'verbose'
          },
          'file_svload': {
              'level': 'DEBUG',
              'class': 'logging.FileHandler',
              'filename': os.path.join(BASE_DIR, 'logs', 'debug_svload.log'),
              'formatter': 'verbose'
          },
          'file_svextract': {
              'level': 'DEBUG',
              'class': 'logging.FileHandler',
              'filename': os.path.join(BASE_DIR, 'logs', 'debug_svextract.log'),
              'formatter': 'verbose'
          },
          'file_svcommon': {
              'level': 'DEBUG',
              'class': 'logging.FileHandler',
              'filename': os.path.join(BASE_DIR, 'logs', 'debug_svextract.log'),
              'formatter': 'verbose'
          },
      },
      'loggers': {
          # 'django': {
          #    'handlers': ['file'],
          #    'level': 'DEBUG',
          # },
          'console_log': {
              'handlers': ['console'],
              'level': 'DEBUG',
          },
          'svtransform': {
              'handlers': ['file_svtransform'],
              'level': 'DEBUG',
          },
          'svload': {
              'handlers': ['file_svload'],
              'level': 'DEBUG',
          },
          'svextract': {
              'handlers': ['file_svextract'],
              'level': 'DEBUG',
          },
          'svcommon': {
              'handlers': ['file_svcommon'],
              'level': 'DEBUG',
          }
      },
  }
  
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/3.1/howto/static-files/
  
  # URI of static files
  STATIC_URL = '/static/'
  # actual location of static files
  STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]  # 이 리스트에 STATIC_ROOT에서 정의한 디렉토리가 포함되면 안됨
  #STATIC_ROOT = os.path.join(BASE_DIR, 'static')  # activate for [python manage.py collectstatic] only
  
  # To access the MEDIA_URL in template you must add django.template.context_processors.media to your context_processeors inside the TEMPLATES config.
  MEDIA_URL = '/media/'
  MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  
  # uploaded edi file location
  EDI_STORAGE_ROOT = 'edi'
  
  # LOGIN_URL = '/accounts/login' # keep default
  # LOGOUT_REDIRECT_URL = '' # keep default
  LOGIN_REDIRECT_URL = '/'
  
  CELERY_BROKER_URL = o_basic_config['CELERY_BROKER_SERVER']['celery_broker_url']  # 'amqp://user_id:user_pw@localhost'
  CELERY_ACKS_LATE = True
  CELERYD_PREFETCH_MULTIPLIER = 1
  
  # slack messenger api
  SLACK_WEB_HOOK_URL = o_basic_config['SLACK_MESSENGER']['slack_web_hook_url']  # 'https://hooks.slack.com/services/1234/345345/435345'
  SLACK_BOT_NAME = o_basic_config['SLACK_MESSENGER']['slack_bot_name']  # 'bot_name'
  SLACK_CHANNEL = o_basic_config['SLACK_MESSENGER']['slack_channel']  # 'ch_name'
  SLACK_USER_OAUTH_TOKEN = o_basic_config['SLACK_MESSENGER']['slack_user_auth_token']  # 'xoxp-2344-32453-34543-dgfss5345345'
  
  del o_basic_config
  
  SV_STORAGE_ROOT = os.path.join(BASE_DIR, 'storage')
  