Get configuration variable from environment variable or
    or django settings.py
504772
def get_aliyun_config(name, default=None):
    '''
    
    '''
    config = os.environ.get(name, getattr(settings, name, default))
    if config is not None:
        if isinstance(config, str):
            return config.strip()
        else:
            return config
    else:
        raise ImproperlyConfigured(
            'Can not get config for {} either in environment'
            'variable or in settings.py'.format(name))
927706
def get_config(cls, key, default=None):
        
        return cls._app.config.get(key, default)
402651
def get_settings(options = {}, request_options = {})
      options['getVersion'] = 2 if !options[:getVersion] && !options['getVersion']
      client.get(Protocol.settings_uri(name, options).to_s, :read, request_options)
    end
580908
def get_setting(setting):
    
    defaults = {
        # The context to use for rendering fields
        'TEMPLATE_FIELD_CONTEXT': {},
        # When this is False, don't do any TemplateField rendering
        'TEMPLATE_FIELD_RENDER': True
    }
    try:
        return getattr(settings, setting, defaults[setting])
    except KeyError:
        msg = "{0} is not specified in your settings".format(setting)
        raise ImproperlyConfigured(msg)
1119923
def getConf(cls, settings, options):
        ""
        ports = ['http_port', 'https_port', 'cache_port']
        for port_name in ports:
            port = getattr(settings, port_name.upper(), None)
            # only use the settings ports if the defaults were left unchanged
            default = getattr(defaults, port_name.upper())
            if port and options.get(port_name) == default:
                options[port_name] = port

        _opts = [
            ('key', 'hx_private_key'),
            ('cert', 'hx_certficate'),
            ('wsgi', 'wsgi_application')
        ]
        for opt_name, settings_name in _opts:
            opt = getattr(settings, settings_name.upper(), None)
            if opt:
                options[opt_name] = opt

        if not options['settings']:
            options['settings'] = environ['DJANGO_SETTINGS_MODULE']
        return options
610108
def detect_django_settings():
    

    matches = []
    for root, dirnames, filenames in os.walk(os.getcwd()):
        for filename in fnmatch.filter(filenames, '*settings.py'):
            full = os.path.join(root, filename)
            if 'site-packages' in full:
                continue
            full = os.path.join(root, filename)
            package_path = full.replace(os.getcwd(), '')
            package_module = package_path.replace(os.sep, '.').split('.', 1)[1].replace('.py', '')

            matches.append(package_module)
    return matches
339511
def get_property(self, key):
        """"""
        _key = DJANGO_CONF[key]
        return getattr(self, _key, CONF_SPEC[_key])
646795
def get_env_setting(setting):
    
    try:
        return os.environ[setting]
    except KeyError:
        error_msg = "Set the %s env variable" % setting
        raise ImproperlyConfigured(error_msg)
603699
def get(cls, key, default=None, separator='.', global_=False):
        
        # first check environnment variables
        # if we're not in global scope
        if not global_:
            ret = os.environ.get(key.upper().replace('.', '_'))
            if ret is not None:
                return ret

        # then check in local and global configuration unless global_=True
        scopes = ['global'] if global_ else ['local', 'global']
        for scope in scopes:
            ret = cls._get(scope, key, default, separator)
            if ret is not None and ret != default:
                return ret

        if ret is None or ret == default:
            return default
251310
def get_app_settings_from_arguments(args):
    
    config_filepath = os.path.abspath(args.config_uri)
    return get_appsettings(config_filepath, name=args.config_name)
276567
def get_django_settings(cls, name, default=None):
        # pylint: disable=access-member-before-definition
        
        if hasattr(cls, '__django_settings__'):
            return getattr(cls.__django_settings__, name, default)
        from django.conf import settings
        cls.__django_settings__ = settings
        return cls.get_django_settings(name)
123361
def get_settings():
    '''
    
    '''
    settings = {}
    for config_file in config_files():
        config_contents = load_config(config_file)
        if config_contents is not None:
            settings = deep_merge(settings, config_contents)
    return settings
879673
def get_env(name):
    ""
    res = os.environ.get(name,'')
    return res if len(res) else "Unknown"
617631
def _setup(self, name=None):
        
        envvar = self.__dict__['env_var']
        if envvar:
            settings_file = os.environ.get(envvar)
        else:
            settings_file = self.__dict__['file_path']

        if not settings_file:
            msg = ("Requested settings, but none can be obtained for the envvar."
                   "Since no config filepath can be obtained, a default config "
                   "will be used.")
            logger.error(msg)
            raise OSError(msg)

        self._wrapped = Settings(settings_file)
324742
def jinja_env(self):
        """"""
        if self._jinja_env is None:
            self._jinja_env = SandboxedEnvironment(
                extensions=[
                    'jinja2.ext.autoescape', 'jinja2.ext.with_', ],
                autoescape=True,
            )
            self._jinja_env.globals['url_for'] = url_for
            # Load whitelisted configuration variables.
            for var in self.app.config['PAGES_WHITELIST_CONFIG_KEYS']:
                self._jinja_env.globals[var] = self.app.config.get(var)
        return self._jinja_env
709956
def findSettingsModule():
    ""
    try:
        with open('manage.py', 'r') as manage:
            manage_contents = manage.read()

            search = re.search(
                r"([\"\'](?P<module>[a-z\.]+)[\"\'])", manage_contents
            )
            if search:  # django version < 1.7
                settings_mod = search.group("module")

            else:
                # in 1.7, manage.py settings declaration looks like:
                # os.environ.setdefault(
                #     "DJANGO_SETTINGS_MODULE", "example_app.settings"
                # )
                search = re.search(
                    "\".*?\"(,\\s)??\"(?P<module>.*?)\"\\)$",
                    manage_contents, re.I | re.S | re.M
                )
                settings_mod = search.group("module")

        os.environ.setdefault('DJANGO_SETTINGS_MODULE', settings_mod)
    except IOError as e:
        msg = (
                str(e) + '\nPlease ensure that you are in the same directory '
                         'as django\'s "manage.py" file.'
        )
        raise IOError(chalk.red(msg), None, sys.exc_info()[2])
    except AttributeError:
        settings_mod = ''
    return settings_mod
1092648
def config(env=DEFAULT_ENV, default=None):
    """"""

    conf = {}

    s = os.environ.get(env, default)

    if s:
        conf = parse(s)

    return conf