我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用settings.MEDIA_ROOT。
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