本文整理匯總了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