from flask import Blueprint, Flask, request, flash, render_template, url_for, session, redirect, abort, make_response, send_file, escape import glob, os, sys logs = Blueprint('logs', __name__, template_folder='templates') @logs.route('/logs/') def logfile(): if 'username' in session : with open('log.txt', 'r') as log: logs=log.readlines() log.close() for line in logs: return render_template('logs.html', logs=logs, line=line) else : return redirect(url_for('loginlogout.login', _external=True))