pywallter/pywallter.py

90 lines
2.3 KiB
Python
Executable File

#!/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
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
from views.gallery import mygallery
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)
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)
app.register_blueprint(postit)
app.register_blueprint(filesupload)
app.register_blueprint(profil)
app.register_blueprint(logs)
app.register_blueprint(loginlogout)
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']
extensionimg = app.config['EXT_IMG']
app.register_blueprint(inscription)
app.register_blueprint(postit)
app.register_blueprint(filesupload)
app.register_blueprint(profil)
app.register_blueprint(logs)
app.register_blueprint(loginlogout)
app.register_blueprint(mygallery)
return app
if __name__ == '__main__' :
hostname=gethostname()
app.run(host='127.0.0.1', port=8080, debug=False)