コード例 #1
0
ファイル: custom.py プロジェクト: edthedev/spotseeker_server
    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())
コード例 #2
0
ファイル: _util.py プロジェクト: edthedev/spotseeker_server
def media_root():
    '''
    Return a media root based on whether caller is service user or developer.
    '''
    if sdg.is_service_user():
        return os.path.join(get_base(), _PATH_PART_WEB, 'static')
    
    #   Get __file__ attribute from caller's frame.
    ##### FIXME
    dir = os.path.dirname \
            (inspect.currentframe().f_back.f_globals.get('__file__'))
    return os.path.abspath(os.path.join(dir, '../../web/static'))
コード例 #3
0
ファイル: _util.py プロジェクト: edthedev/spotseeker_server
def template_dir():
    '''
    Return a tuple of template directories based on whether caller is
    service user or deveeloper.
    '''
    if sdg.is_service_user():
        return (os.path.join(get_base(), _PATH_PART_WEB, 'template'), )

    #   Get __file__ attribute from caller's frame.
    ##### FIXME
    dir = os.path.dirname \
            (inspect.currentframe().f_back.f_globals.get('__file__'))
    return (os.path.abspath(os.path.join(dir, '../../web/template')), )