2022-07-04 22:52:06 +02:00
|
|
|
#!/usr/local/bin/python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from flask import Flask, request, flash, render_template, url_for, session, redirect, abort, make_response, send_file, escape, send_from_directory
|
|
|
|
from werkzeug.utils import secure_filename
|
|
|
|
from wtforms import BooleanField, StringField, IntegerField, PasswordField, validators
|
|
|
|
import sqlite3
|
|
|
|
from flask_bcrypt import Bcrypt
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-10 15:09:03 +02:00
|
|
|
from views.blog import postit
|
2022-07-04 22:52:06 +02:00
|
|
|
from views.filesupload import filesupload
|
|
|
|
from views.inscription import inscription
|
|
|
|
from views.profil import profil
|
|
|
|
from views.logs import logs
|
|
|
|
from views.loginlogout import loginlogout
|
2022-08-06 18:22:24 +02:00
|
|
|
from views.gallery import mygallery
|
2022-07-04 22:52:06 +02:00
|
|
|
|
2022-08-06 18:22:24 +02:00
|
|
|
from tools.databaseinit import init_db, init_dir, db_migrate
|
2022-07-04 22:52:06 +02:00
|
|
|
|
|
|
|
import glob, os, sys, time
|
|
|
|
|
|
|
|
app = Flask( 'pywallter' )
|
2022-07-11 00:36:31 +02:00
|
|
|
app.config.from_pyfile('config.py')
|
2022-07-04 22:52:06 +02:00
|
|
|
bcrypt = Bcrypt(app)
|
|
|
|
|
2022-08-06 18:22:24 +02:00
|
|
|
init_db()
|
|
|
|
db_migrate()
|
2022-07-04 22:52:06 +02:00
|
|
|
if init_dir():
|
|
|
|
print ("Le repertoire des utilisateurs a été créer")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Set the secret key. Keep this really secret
|
2022-07-11 00:36:31 +02:00
|
|
|
#app.secret_key = 'klfkdlfkdslfkln234325;cx!' # Chiffre les cookies si j'ai bien capté.
|
2022-07-04 22:52:06 +02:00
|
|
|
# À générer aléatoirement impérativement avant de mettre en ligne.
|
|
|
|
|
|
|
|
#### Variables ####################################################################################
|
|
|
|
|
|
|
|
|
2022-07-11 00:36:31 +02:00
|
|
|
DOSSIER_PERSO= app.config['DOSSIER_APP']
|
2022-07-04 22:52:06 +02:00
|
|
|
|
2022-07-11 00:36:31 +02:00
|
|
|
extensionimg = app.config['EXT_IMG']
|
2022-07-04 22:52:06 +02:00
|
|
|
|
|
|
|
##################################################################################################
|
|
|
|
|
|
|
|
app.register_blueprint(inscription)
|
2022-07-10 15:09:03 +02:00
|
|
|
app.register_blueprint(postit)
|
2022-07-04 22:52:06 +02:00
|
|
|
app.register_blueprint(filesupload)
|
|
|
|
app.register_blueprint(profil)
|
|
|
|
app.register_blueprint(logs)
|
|
|
|
app.register_blueprint(loginlogout)
|
2022-08-06 18:22:24 +02:00
|
|
|
app.register_blueprint(mygallery)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_app():
|
|
|
|
|
|
|
|
app = Flask( 'pywallter' )
|
|
|
|
app.config.from_pyfile('config.py')
|
|
|
|
bcrypt = Bcrypt(app)
|
|
|
|
|
|
|
|
init_db()
|
|
|
|
db_migrate()
|
|
|
|
if init_dir():
|
|
|
|
print ("Le repertoire des utilisateurs a été créer")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOSSIER_PERSO= app.config['DOSSIER_APP']
|
2022-07-04 22:52:06 +02:00
|
|
|
|
2022-08-06 18:22:24 +02:00
|
|
|
extensionimg = app.config['EXT_IMG']
|
2022-07-04 22:52:06 +02:00
|
|
|
|
|
|
|
|
2022-08-06 18:22:24 +02:00
|
|
|
app.register_blueprint(inscription)
|
|
|
|
app.register_blueprint(postit)
|
|
|
|
app.register_blueprint(filesupload)
|
|
|
|
app.register_blueprint(profil)
|
|
|
|
app.register_blueprint(logs)
|
|
|
|
app.register_blueprint(loginlogout)
|
2022-08-06 23:49:16 +02:00
|
|
|
app.register_blueprint(mygallery)
|
|
|
|
|
2022-08-06 18:22:24 +02:00
|
|
|
return app
|
2022-07-04 22:52:06 +02:00
|
|
|
|
|
|
|
if __name__ == '__main__' :
|
2022-08-06 18:22:24 +02:00
|
|
|
hostname=gethostname()
|
|
|
|
app.run(host='127.0.0.1', port=8080, debug=False)
|