Python settings 模块,MEDIA_ROOT 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用settings.MEDIA_ROOT

项目:AlmostSignificant    作者:bartongroup    | 项目源码 | 文件源码
def createMediaFolder( runName ):
    """creates a run folder based on the run name given, if one doesn't already exist,
        that is located in the django media folder location"""
    mediaFolder = settings.MEDIA_ROOT
    currentMediaFolder = os.path.join(mediaFolder, runName)
    try:
        if not os.path.exists( currentMediaFolder ):
            os.mkdir( currentMediaFolder )
    except:
        print "Cannot create media folder: %s" % currentMediaFolder
        raise

    return currentMediaFolder