Python settings.MEDIA_ROOT Examples

The following are 10 code examples of settings.MEDIA_ROOT(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module settings , or try the search function .
Example #1
Source File: autoncore.py    From OnToology with Apache License 2.0 6 votes vote down vote up
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:])
#
# 
Example #2
Source File: document_bulk_delete.py    From lexpredict-contraxsuite with GNU Affero General Public License v3.0 5 votes vote down vote up
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 
Example #3
Source File: douban.py    From listen1 with MIT License 5 votes vote down vote up
def get_douban_token_file_path():
    root_dir = MEDIA_ROOT + '/user/'
    filename = root_dir + 'douban_userinfo.json'
    return filename 
Example #4
Source File: douban.py    From listen1 with MIT License 5 votes vote down vote up
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) 
Example #5
Source File: douban.py    From listen1 with MIT License 5 votes vote down vote up
def _clear_temp_folder():
    path = MEDIA_ROOT + '/temp/'
    files = glob.glob(path + '*')
    for f in files:
        os.remove(f) 
Example #6
Source File: douban.py    From listen1 with MIT License 5 votes vote down vote up
def get_store_filename(cls):
        root_dir = MEDIA_ROOT + '/user/'
        filename = root_dir + 'douban_userinfo.json'
        return filename 
Example #7
Source File: douban.py    From listen1 with MIT License 5 votes vote down vote up
def get_douban_token_file_path():
    root_dir = MEDIA_ROOT + '/user/'
    filename = root_dir + 'douban_userinfo.json'
    return filename 
Example #8
Source File: douban.py    From listen1 with MIT License 5 votes vote down vote up
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) 
Example #9
Source File: douban.py    From listen1 with MIT License 5 votes vote down vote up
def _clear_temp_folder():
    path = MEDIA_ROOT + '/temp/'
    files = glob.glob(path + '*')
    for f in files:
        os.remove(f) 
Example #10
Source File: douban.py    From listen1 with MIT License 5 votes vote down vote up
def get_store_filename(cls):
        root_dir = MEDIA_ROOT + '/user/'
        filename = root_dir + 'douban_userinfo.json'
        return filename