33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
from flask import Blueprint, Flask, request, flash, render_template, url_for, session, redirect, abort, make_response, send_file
|
|
import glob, os, sys
|
|
from markupsafe import escape
|
|
|
|
logs = Blueprint('logs', __name__, template_folder='templates')
|
|
|
|
app = Flask( 'pywallter' )
|
|
app.config.from_pyfile('config.py')
|
|
|
|
|
|
#### Variables ####################################################################################
|
|
|
|
DOSSIER_PERSO= app.config['DOSSIER_APP']
|
|
|
|
extensionimg = app.config['EXT_IMG']
|
|
|
|
DATABASE = app.config['DATABASE']
|
|
##################################################################################################
|
|
|
|
|
|
@logs.route('/logs/')
|
|
def logfile():
|
|
if 'username' in session:
|
|
UTILISATEUR='%s'% escape(session['username'])
|
|
log_file=os.path.join(DOSSIER_PERSO, UTILISATEUR, "log.txt")
|
|
with open(log_file, 'r') as log:
|
|
print("on passe ici")
|
|
logs=log.readlines()
|
|
log.close()
|
|
return render_template('logs.html', section="Logs", logs=logs)
|
|
else :
|
|
return redirect(url_for('loginlogout.login', _external=True), code=401)
|