Settings.py 344 Bytes
Newer Older
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
import os

def get_setting(name, **kwargs):
    value = os.environ.get(name)
    if 'settings' in kwargs:
        value = kwargs['settings'].pop(name, value)
    if value is not None: return value
    if 'default' in kwargs: return kwargs['default']
    raise Exception('Setting({}) not specified in environment or configuration'.format(name))