from os import environ import yaml from registrar.settings.base import * from registrar.settings.utils import get_env_setting, get_logger_config DEBUG = False TEMPLATE_DEBUG = DEBUG ALLOWED_HOSTS = ['*'] LOGGING = get_logger_config() # This may be overridden by the YAML in REGISTRAR_CFG, but it should be here as a default. MEDIA_STORAGE_BACKEND = {} # Keep track of the names of settings that represent dicts. Instead of overriding the values in base.py, # the values read from disk should UPDATE the pre-configured dicts. DICT_UPDATE_KEYS = ('JWT_AUTH',) CONFIG_FILE = get_env_setting('REGISTRAR_CFG') with open(CONFIG_FILE, encoding='utf-8') as f: config_from_yaml = yaml.safe_load(f) # Remove the items that should be used to update dicts, and apply them separately rather # than pumping them into the local vars. dict_updates = {key: config_from_yaml.pop(key, None) for key in DICT_UPDATE_KEYS} for key, value in dict_updates.items(): if value:
from registrar.settings.local import * from registrar.settings.utils import get_logger_config ALLOWED_HOSTS = ['*'] LOGGING = get_logger_config(debug=True, dev_env=True, local_loglevel='DEBUG') del LOGGING['handlers']['local'] SECRET_KEY = os.environ.get('SECRET_KEY', 'change-me') LANGUAGE_CODE = os.environ.get('LANGUAGE_CODE', 'en') CELERY_ALWAYS_EAGER = (os.environ.get("CELERY_ALWAYS_EAGER", "false").lower() == "true") CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': os.environ.get('CACHE_LOCATION', 'memcached:11211'), } } DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': os.environ.get('DB_NAME', 'regsitrar'), 'USER': os.environ.get('DB_USER', 'regsitrar001'), 'PASSWORD': os.environ.get('DB_PASSWORD', 'password'), 'HOST': os.environ.get('DB_HOST', 'db'), 'PORT': os.environ.get('DB_PORT', 3306), 'ATOMIC_REQUESTS': False, 'CONN_MAX_AGE': 60,