Exemplo n.º 1
0
    def _choose_extra_settings(cls, app_name):
        '''
        Choose what directory and filename are used for extra settings file.
        '''
        #   List of paths to add when running as developer.
        _developer_settings_path_list   = \
            [
            util.get_base(),
            ]

        #   List of paths to add when running as service user.
        _service_settings_path_list     = \
            [
            os.path.join(util.get_base(), util._PATH_PART_CONFIG),
            ]

        #   Set up settings file name depending who's running
        if sdg.is_service_user():
            modname = '%s_settings_customer' % app_name
            path_list = _developer_settings_path_list
            return modname, path_list

        if sdg.is_developer():
            modname = '%s_settings_developer' % app_name
            path_list = _service_settings_path_list
            return modname, path_list

        raise ValueError('can\'t find settings; invalid home directory: %s' % \
                         sdg.get_home())
Exemplo n.º 2
0
def get_base():
    # _debug_outerframes(label='get_base')

    base_dir = os.environ.get('PROJECT_ROOT_DIRECTORY', '')

    if base_dir:
        return base_dir

    settings_frame = _get_settings_frame()

    if settings_frame:
        base_dir = settings_frame.f_globals.get('PROJECT_ROOT_DIRECTORY', '')

        if base_dir:
            return base_dir

    return sdg.get_home()