""" Dynamic settings file for site customization. """ from core.utils.configparser import Custom_ConfigParser config = Custom_ConfigParser() config.read('/etc/numeter/numeter_webapp.cfg') import os BASEDIR = os.path.dirname(os.path.abspath(__file__)) # Use a file to get SECRET_KEY SECRET_KEY_FILE = config.get_d('global', 'secret_key_file', '/etc/numeter/secret_key.txt') with open(SECRET_KEY_FILE, 'r') as f: SECRET_KEY = f.read().strip() DEBUG = config.getboolean_d('debug', 'debug', False) TEMPLATE_DEBUG = DEBUG ADMINS = config.getobj_d('global', 'admins') MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': config.get('database', 'engine'), 'NAME': config.get('database', 'name'), 'USER': config.get_d('database', 'user', ''), 'PASSWORD': config.get_d('database', 'password', ''), 'HOST': config.get_d('database', 'host', ''), 'PORT': config.get_d('database', 'port', ''),
""" Settings used in testing. """ from core.utils.configparser import Custom_ConfigParser config = Custom_ConfigParser() config.read('/etc/numeter/numeter_webapp.cfg') import os BASEDIR = os.path.dirname(os.path.abspath(__file__)) # Disable logger import logging logging.disable(logging.CRITICAL) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': '/tmp/test_numeter.sqlite', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', } } # Use it as below # Storage.objects.create(**settings.TEST_STORAGE) TEST_STORAGES = [] if config.get_d('test', 'storage1_address', False): TEST_STORAGES.append({
""" Dynamic settings file for site customization. """ from core.utils.configparser import Custom_ConfigParser config = Custom_ConfigParser() config.read('/etc/numeter/numeter_webapp.cfg') import os BASEDIR = os.path.dirname(os.path.abspath(__file__)) # Use a file to get SECRET_KEY SECRET_KEY_FILE = config.get_d('global', 'secret_key_file', '/etc/numeter/secret_key.txt') with open(SECRET_KEY_FILE, 'r') as f: SECRET_KEY = f.read().strip() DEBUG = config.getboolean_d('debug', 'debug', False) TEMPLATE_DEBUG = DEBUG ADMINS = config.getobj_d('global', 'admins') MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': config.get('database', 'engine'), 'NAME': config.get('database', 'name'), 'USER': config.get_d('database', 'user', ''), 'PASSWORD': config.get_d('database', 'password', ''), 'HOST': config.get_d('database', 'host', ''), 'PORT': config.get_d('database', 'port', ''), }