本文整理汇总了Python中settings.MEDIA_ROOT属性的典型用法代码示例。如果您正苦于以下问题:Python settings.MEDIA_ROOT属性的具体用法?Python settings.MEDIA_ROOT怎么用?Python settings.MEDIA_ROOT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类settings
的用法示例。
在下文中一共展示了settings.MEDIA_ROOT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_user_log
# 需要导入模块: import settings [as 别名]
# 或者: from settings import MEDIA_ROOT [as 别名]
def generate_user_log(log_file_name):
# comm = 'cp ' + home + 'log/' + log_file_name + ' ' + \
comm = 'cp ' + os.path.join(home, 'log', log_file_name) + ' ' + \
os.path.join(settings.MEDIA_ROOT,
'logs') # ' /home/ubuntu/auton/media/logs/'
print comm
sys.stdout.flush()
if sys.stdout == default_stdout:
print 'Warning: trying to close sys.stdout in generate_user_log function, I am disabling the closing for now'
call(comm, shell=True)
# #########################################################################
# ################################### main #############################
# #########################################################################
#
# if __name__ == "__main__":
# print "autoncore command: " + str(sys.argv)
# if use_database:
# connect('OnToology')
# git_magic(sys.argv[1], sys.argv[2], sys.argv[3:])
#
#
示例2: delete_files
# 需要导入模块: import settings [as 别名]
# 或者: from settings import MEDIA_ROOT [as 别名]
def delete_files(self, ids: List[int]) -> None:
paths = self.document_repository.get_all_document_source_paths(ids)
for path in paths:
file_path = os.path.join(
settings.MEDIA_ROOT,
settings.FILEBROWSER_DOCUMENTS_DIRECTORY,
path)
try:
os.remove(file_path)
except OSError:
pass
示例3: get_douban_token_file_path
# 需要导入模块: import settings [as 别名]
# 或者: from settings import MEDIA_ROOT [as 别名]
def get_douban_token_file_path():
root_dir = MEDIA_ROOT + '/user/'
filename = root_dir + 'douban_userinfo.json'
return filename
示例4: _get_captcha
# 需要导入模块: import settings [as 别名]
# 或者: from settings import MEDIA_ROOT [as 别名]
def _get_captcha():
# get valid code from douban server
# save it to temp folder
filename = str(uuid.uuid4()) + '.jpg'
path = MEDIA_ROOT + '/temp/' + filename
token = get_captcha_token(path)
return dict(path='/static/temp/' + filename, token=token)
示例5: _clear_temp_folder
# 需要导入模块: import settings [as 别名]
# 或者: from settings import MEDIA_ROOT [as 别名]
def _clear_temp_folder():
path = MEDIA_ROOT + '/temp/'
files = glob.glob(path + '*')
for f in files:
os.remove(f)
示例6: get_store_filename
# 需要导入模块: import settings [as 别名]
# 或者: from settings import MEDIA_ROOT [as 别名]
def get_store_filename(cls):
root_dir = MEDIA_ROOT + '/user/'
filename = root_dir + 'douban_userinfo.json'
return filename