pywallter/pywallter.py

90 lines
2.3 KiB
Python
Raw Normal View History

#!/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
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-08-06 18:22:24 +02:00
from tools.databaseinit import init_db, init_dir, db_migrate
import glob, os, sys, time
app = Flask( 'pywallter' )
app.config.from_pyfile('config.py')
bcrypt = Bcrypt(app)
2022-08-06 18:22:24 +02:00
init_db()
db_migrate()
if init_dir():
print ("Le repertoire des utilisateurs a été créer")
# Set the secret key. Keep this really secret
#app.secret_key = 'klfkdlfkdslfkln234325;cx!' # Chiffre les cookies si j'ai bien capté.
# À générer aléatoirement impérativement avant de mettre en ligne.
#### Variables ####################################################################################
DOSSIER_PERSO= app.config['DOSSIER_APP']
extensionimg = app.config['EXT_IMG']
##################################################################################################
app.register_blueprint(inscription)
2022-07-10 15:09:03 +02:00
app.register_blueprint(postit)
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-08-06 18:22:24 +02:00
extensionimg = app.config['EXT_IMG']
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
if __name__ == '__main__' :
2022-08-06 18:22:24 +02:00
hostname=gethostname()
app.run(host='127.0.0.1', port=8080, debug=False)