TG-48 Merge branch 'master' of http://git.rdrive.ovh/Project_OLA/OLA
This commit is contained in:
commit
719aadf613
@ -5,6 +5,7 @@ from app.config import Config
|
|||||||
from flask import Flask, session
|
from flask import Flask, session
|
||||||
from flask_restful import Api
|
from flask_restful import Api
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
from sqlalchemy import MetaData
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.ext.automap import automap_base
|
from sqlalchemy.ext.automap import automap_base
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ db = SQLAlchemy(app)
|
|||||||
Base = automap_base()
|
Base = automap_base()
|
||||||
engine = create_engine(app.config["SQLALCHEMY_DATABASE_URI"])
|
engine = create_engine(app.config["SQLALCHEMY_DATABASE_URI"])
|
||||||
Base.prepare(engine, reflect=True)
|
Base.prepare(engine, reflect=True)
|
||||||
|
meta = MetaData(engine, True)
|
||||||
|
|
||||||
# RestFul Flask
|
# RestFul Flask
|
||||||
api = Api(app)
|
api = Api(app)
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
from app.core import Base
|
from app.core import meta
|
||||||
|
from sqlalchemy import Table
|
||||||
|
|
||||||
USER = Base.classes.user
|
USER = Table('USER', meta, autoload=False)
|
||||||
SETTINGS = Base.classes.settings
|
SETTINGS = Table('SETTINGS', meta, autoload=False)
|
||||||
HASHTABLE = Base.classes.hashtable
|
HASHTABLE = Table('HASHTABLE', meta, autoload=False)
|
||||||
GROUP = Base.classes.group
|
GROUP = Table('GROUP', meta, autoload=False)
|
||||||
GROUP_CONTENT = Base.classes.group_content
|
TUTORSHIP = Table('TUTORSHIP', meta, autoload=False)
|
||||||
PERIOD = Base.classes.period
|
PERIOD = Table('PERIOD', meta, autoload=False)
|
||||||
LIVRET = Base.classes.livret
|
LIVRET = Table('LIVRET', meta, autoload=False)
|
||||||
|
@ -4,11 +4,10 @@ import os
|
|||||||
import unittest
|
import unittest
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
from app.config import Config
|
||||||
from flask_script import Manager, Command
|
from flask_script import Manager, Command
|
||||||
from flask_script import prompt_bool
|
from flask_script import prompt_bool
|
||||||
|
|
||||||
from app.config import Config
|
|
||||||
|
|
||||||
warnings.simplefilter('ignore')
|
warnings.simplefilter('ignore')
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
@ -25,6 +24,7 @@ else:
|
|||||||
Config.configure_app(config="prod")
|
Config.configure_app(config="prod")
|
||||||
|
|
||||||
core = importlib.import_module("app.core")
|
core = importlib.import_module("app.core")
|
||||||
|
model = importlib.import_module("backend.app.model")
|
||||||
|
|
||||||
manager = Manager(core.app)
|
manager = Manager(core.app)
|
||||||
manager.add_option("-d", "--debug",
|
manager.add_option("-d", "--debug",
|
||||||
@ -59,7 +59,12 @@ class CheckDB(Command):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
print("List of parsed tables:")
|
print("List of parsed tables:")
|
||||||
print(core.db.metadata.tables.keys())
|
print(core.meta.tables.keys())
|
||||||
|
query = model.SETTINGS.select()
|
||||||
|
result = query.execute()
|
||||||
|
print("\nSETTINGS content :")
|
||||||
|
for res in result:
|
||||||
|
print(res.key + " = " + res.value)
|
||||||
|
|
||||||
|
|
||||||
manager.add_command('checkdb', CheckDB())
|
manager.add_command('checkdb', CheckDB())
|
||||||
|
Reference in New Issue
Block a user