Compare commits
No commits in common. "0e282894a6b9b3c758914b0831cabc229f55b58f" and "4288eca55165b50ba5c97965b95694386e84590d" have entirely different histories.
0e282894a6
...
4288eca551
15
pywallter.py
15
pywallter.py
@ -18,7 +18,7 @@ from views.logs import logs
|
||||
from views.loginlogout import loginlogout
|
||||
from views.gallery import mygallery
|
||||
|
||||
from tools.databaseinit import init_db, check_directories, db_migrate
|
||||
from tools.databaseinit import init_db, init_dir, db_migrate
|
||||
|
||||
import glob, os, sys, time
|
||||
|
||||
@ -26,25 +26,22 @@ 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")
|
||||
|
||||
|
||||
#### Variables Globales #########################################################################
|
||||
|
||||
|
||||
DOSSIER_PERSO= app.config['DOSSIER_APP']
|
||||
DATABASE= app.config['DATABASE']
|
||||
|
||||
extensionimg = app.config['EXT_IMG']
|
||||
MAIL_SERVER = app.config['MAIL_SERVER']
|
||||
XMPP_SERVER = app.config['XMPP_SERVER']
|
||||
#################################################################################################
|
||||
|
||||
init_db(DATABASE)
|
||||
check_directories(DOSSIER_PERSO)
|
||||
db_migrate(DATABASE)
|
||||
|
||||
|
||||
|
||||
xmpp_server_not_installed = system('whereis prosodyctl')
|
||||
mail_server_not_installed = system('whereis set_mail_alias') + system('whereis set_mail_passwd') + \
|
||||
system('whereis dovecot') + system('whereis smtpd')
|
||||
|
||||
@ -5,12 +5,17 @@ from tools.utils import gen_token
|
||||
from flask_bcrypt import Bcrypt
|
||||
|
||||
app = Flask( 'pywallter' )
|
||||
app.config.from_pyfile('config.py')
|
||||
bcrypt = Bcrypt(app)
|
||||
|
||||
DATABASE = app.config['DATABASE']
|
||||
DOSSIER_PERSO = app.config['DOSSIER_APP']
|
||||
DATABASE = app.config['DATABASE']
|
||||
|
||||
|
||||
def init_db(database):
|
||||
conn = sqlite3.connect(database)
|
||||
|
||||
def init_db():
|
||||
conn = sqlite3.connect(DATABASE)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS users(
|
||||
@ -76,16 +81,14 @@ def init_db(database):
|
||||
conn.close()
|
||||
print ('table posts OK')
|
||||
|
||||
def check_directories(users_folder):
|
||||
|
||||
if os.path.isdir(users_folder):
|
||||
print("Le dossier {} existe".format(users_folder))
|
||||
def init_dir():
|
||||
if os.path.isdir('users'):
|
||||
return False
|
||||
else:
|
||||
os.makedirs(users_folder)
|
||||
print("Le dossier {} a été créé".format(users_folder))
|
||||
os.makedirs('./users/')
|
||||
|
||||
def db_migrate(database):
|
||||
conn = sqlite3.connect(database)
|
||||
def db_migrate():
|
||||
conn = sqlite3.connect(DATABASE)
|
||||
cursor = conn.cursor()
|
||||
|
||||
cursor.execute("""SELECT name FROM PRAGMA_TABLE_INFO('users');""")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user