remplacement des menu et ajout d'un fichiers de configuration

This commit is contained in:
2022-07-11 00:36:31 +02:00
parent 6b264cd46b
commit 66375d272f
17 changed files with 69 additions and 494 deletions

View File

@@ -37,7 +37,7 @@ def racine_blog():
status=row[4], avatar=row[5], nom=row[6], prenom=row[7], age=row[8])
for row in reversed(cursor.fetchall())]
conn.close()
return render_template('blog.html', posts=posts)
return render_template('blog.html', section='Post-it', posts=posts)
else:
return redirect(url_for('loginlogout.login', _external=True))
@@ -75,6 +75,8 @@ def edit(post):
cursor.execute("""SELECT title, content FROM posts WHERE title=?""", (post,))
oldpost = (cursor.fetchone())
conn.close()
return render_template('postedit.html', oldpost=oldpost)
return render_template('postedit.html',
section='Post-it',
oldpost=oldpost)
else:
return redirect(url_for('loginlogout.login', _external=True)) # sinon on redirige vers login)

View File

@@ -8,12 +8,14 @@ import sqlite3
import os
app = Flask( 'pywallter' )
app.config.from_pyfile('config.py')
filesupload = Blueprint('filesupload', __name__, template_folder='templates')
DOSSIER_PERSO='users/'
extensionimg = {'.jpg', '.JPG', '.png', '.PNG', '.gif', '.GIF', '.bmp', '.BMP', '.jpeg', '.JPEG' }
DOSSIER_PERSO= app.config['DOSSIER_APP']
extensionimg = app.config['EXT_IMG']
@filesupload.route( '/filesupload/', methods=['GET', 'POST'])
def uploadfiles():
@@ -68,7 +70,7 @@ def uploadfiles():
else:
flash(u'Error : Vous avez oublié le fichier !', 'error')
return redirect(url_for('filesupload.uploadfiles'))
resp = make_response(render_template('up_up.html'))
resp = make_response(render_template('up_up.html', section="Upload"))
resp.set_cookie('username', session['username'])
return resp
else :
@@ -87,7 +89,11 @@ def list():
i += 1
size = os.path.getsize(DOSSIER_PERSO + UTILISATEUR + '/files/' + fich) # size = taille des fichiers
listeFichiers.append([i, fich, size]) # On implémente la listeFichiers avec le num le ficier et sa taille
return render_template('up_list.html',size=size, i=i, listeFichiers=listeFichiers)
return render_template('up_list.html',
section="Files",
size=size,
i=i,
listeFichiers=listeFichiers)
else :
flash(u'Aucun fichier uploadé ! Redirection vers Upload', 'error')
return redirect(url_for('filesupload.uploadfiles', external=True))

View File

@@ -3,11 +3,20 @@ from flask_bcrypt import Bcrypt
import sqlite3
import glob, os, sys, time
app = Flask( 'pywallter' )
app.config.from_pyfile('config.py')
bcrypt = Bcrypt(app)
DOSSIER_PERSO='users/'
#### Variables ####################################################################################
DOSSIER_PERSO= app.config['DOSSIER_APP']
extensionimg = app.config['EXT_IMG']
##################################################################################################
inscription = Blueprint('inscription', __name__, template_folder='templates')

View File

@@ -10,7 +10,6 @@ def logfile():
logs=log.readlines()
log.close()
for line in logs:
return render_template('logs.html', logs=logs, line=line)
return render_template('logs.html', section="Logs", logs=logs, line=line)
else :
return redirect(url_for('loginlogout.login', _external=True))

View File

@@ -7,8 +7,19 @@ import os
profil = Blueprint('profil', __name__, template_folder='templates')
DOSSIER_PERSO='users/'
extensionimg = {'.jpg', '.JPG', '.png', '.PNG', '.gif', '.GIF', '.bmp', '.BMP', '.jpeg', '.JPEG' }
app = Flask( 'pywallter' )
app.config.from_pyfile('config.py')
#### Variables ####################################################################################
DOSSIER_PERSO= app.config['DOSSIER_APP']
extensionimg = app.config['EXT_IMG']
##################################################################################################
@profil.route('/profil/', methods=['GET','POST'] )
def profile() :
@@ -71,7 +82,10 @@ def profile() :
return render_template('profil.html', profil=profil_user, username=UTILISATEUR)
return render_template('profil.html',
section="Profil",
profil=profil_user,
username=UTILISATEUR)
else :
return redirect(url_for('loginlogout.login', _external=True))