text: """
  Django settings for config project.
  
  Generated by 'django-admin startproject' using Django 3.0.5.
  
  For more information on this file, see
  https://docs.djangoproject.com/en/3.0/topics/settings/
  
  For the full list of settings and their values, see
  https://docs.djangoproject.com/en/3.0/ref/settings/
  """
  
  import os
  import datetime
  
  AUTH_USER_MODEL = 'account.User'
  
  # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  BASE_DIR = os.path.abspath(os.path.join(__file__, '../../../'))
  
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = os.environ.get('SECRET_KEY', '46#w4!snay21xkvn(%$pr-$)7-u-#jf0*s9#*gb@_3lcudr%_8')
  
  # SECURITY WARNING: don't run with debug turned on in production!
  # DEBUG = False
  # STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
  
  ALLOWED_HOSTS = ['*']
  
  
  # Application definition
  
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'rest_framework',
      'account',
      'app',
  ]
  
  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 = 'config.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          # 'DIRS': [],
          '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',
              ],
              'libraries':{
                  'static_cb': 'account.templatetags.static_cb',
              },
          },
      },
  ]
  
  WSGI_APPLICATION = 'config.wsgi.application'
  
  
  # Database
  # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.mysql',
          'NAME': os.environ['DB_NAME'],
          'USER': os.environ['DB_USER'],
          'PASSWORD': os.environ['DB_PASS'],
          'HOST': 'db',
          'PORT': os.environ['DB_PORT'],
      }
  }
  
  # Password validation
  # https://docs.djangoproject.com/en/3.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/3.0/topics/i18n/
  
  LANGUAGE_CODE = 'ja'
  
  TIME_ZONE = 'Asia/Tokyo'
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/3.0/howto/static-files/
  
  STATIC_URL = '/static/'
  
  REST_FRAMEWORK = {
      # Use Django's standard `django.contrib.auth` permissions,
      # or allow read-only access for unauthenticated users.
      'DEFAULT_PERMISSION_CLASSES': [
          # 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly',
          # 'rest_framework.renderers.JSONRenderer',
          # 'rest_framework.renderers.BrowsableAPIRenderer',
      ]
  }
  
  LOGGING = {
      'version': 1,
      'disable_existing_loggers': False,
      'filters': {
          'require_debug_false': {
              '()': 'django.utils.log.RequireDebugFalse',
          },
          'require_debug_true': {
              '()': 'django.utils.log.RequireDebugTrue',
          },
      },
      'formatters': {
          'django.server': {
              '()': 'django.utils.log.ServerFormatter',
              'format': '[%(server_time)s] %(message)s a',
          },
          'verbose': {
              'format': '%(levelname)s %(asctime)s %(module)s '
                        '%(process)d %(thread)d %(message)s'
          },
          'my_log_format': {
              'format': "\t".join(
                  [
                      "[%(levelname)s]",
                      "%(asctime)s",
                      "%(pathname)s:%(lineno)s",
                      "%(message)s",
                  ]
              )
          }
      },
      'handlers': {
          'console': {
              'level': 'INFO',
              'filters': ['require_debug_true'],
              'class': 'logging.StreamHandler',
              'formatter': 'verbose',
          },
          'django.server': {
              'level': 'INFO',
              'class': 'logging.StreamHandler',
              'formatter': 'django.server',
          },
          'mail_admins': {
              'level': 'ERROR',
              'filters': ['require_debug_false'],
              'class': 'django.utils.log.AdminEmailHandler'
          },
          'my_log': {
              'level': 'DEBUG',
              'class': 'logging.handlers.RotatingFileHandler',
              'filename': '/logs/django/app.log',
              'maxBytes': 50000,
              'backupCount': 2,
              'formatter': 'my_log_format',
          },
          'worker': {
              'level': 'DEBUG',
              'class': 'logging.handlers.RotatingFileHandler',
              'filename': '/logs/celery/worker.log',
              'maxBytes': 50000,
              'backupCount': 2,
              'formatter': 'my_log_format',
          },
          'error': {
              'level': 'ERROR',
              'class': 'logging.handlers.RotatingFileHandler',
              'filename': '/logs/django/error.log',
              'maxBytes': 50000,
              'backupCount': 2,
              'formatter': 'my_log_format',
          },
      },
      'loggers': {
          'django': {
              'handlers': ['console', 'mail_admins', 'error'],
              'level': 'INFO',
          },
          'django.server': {
              'handlers': ['django.server'],
              'level': 'INFO',
              'propagate': False,
          },
          # 追加
          'app': {
              'handlers': ['my_log'],
              'level': os.getenv("DJANGO_LOG_LEVEL", "DEBUG"),
              'propagate': True,
          },
          'worker': {
              'handlers': ['worker'],
              'level': os.getenv("DJANGO_LOG_LEVEL", "DEBUG"),
              'propagate': True,
          },
      }
  }
  LOGIN_URL = '/account/login'     # ログイン
  LOGOUT_URL = '/account/logout'   # ログアウト
  LOGIN_REDIRECT_URL = '/'
  
  # ブラウザキャシュを防ぐためにファイル名のあとにパラメータをつける　{% load static_qb %}
  CACHE_BUSTING_QUERY = datetime.datetime.now().strftime('%Y%m%d%H%M%S%s')
  
  # CELERY
  BROKER_URL = "redis://redis:6379"
  RESULT_BACKEND = "redis://redis:6379"
  CELERY_BROKER_URL = 'redis://redis:6379'
  CELERY_RESULT_BACKEND = 'django-db'
  CELERY_CACHE_BACKEND = 'django-cache'
  CELERYD_LOG_FILE = "/logs/celery/worker.log"
  CELERY_IMPORTS = ('config.tasks')
  
  CACHES = {
      "default": {
          "BACKEND": "django_redis.cache.RedisCache",
          "LOCATION": "redis://redis:6379",
          "OPTIONS": {
              "CLIENT_CLASS": "django_redis.client.DefaultClient",
          }
      }
  }
  