def download(self, log_filename): #If log_filename is 'all', log archive is actually requested. if log_filename == 'all': return self.download_archive() if log_filename not in get_logs_list(): return index() logfile_fullpath = os.path.join(os.getcwd(), settings.LOG_DIR, log_filename) return static.serve_file(logfile_fullpath, "application/x-download", "attachment", os.path.basename(logfile_fullpath))
def index(self): log_files = get_logs_list() return render_template("logs.html", log_files=log_files)