from models.role import Role
from models.permission import Permission

from framework import Config

parser = argparse.ArgumentParser(description="Process some integers.")
parser.add_argument(
    'action', choices=["create_db", "create_admin", "create_missing_tables"])
parser.add_argument('--config', required=False, type=str, default=None)

args = parser.parse_args()

config_loader = ConfigLoader()

if args.config:
    config_loader.load_from_path(args.config)
else:
    config_loader.load_from_default_path()

config = Config()
database_session_maker = config["database_session_maker"]


def drop_all_tables(engine):
    """
    Fix to enable SQLAlchemy to drop tables even if it didn't know about it.
    :param engine:
    :return:
    """
    meta = MetaData(engine)
    meta.reflect()
Exemplo n.º 2
0
import sys

from config import ConfigLoader
from app import FirmQApp

# Config_path get from argv (for uwsgi:app) of default one:
if len(sys.argv) > 1:
    config_path = sys.argv[1]
else:
    config_path = "./conf/app.ini"

config_loader = ConfigLoader()
config_loader.load_from_path(config_path)

app = FirmQApp()
wsgi = app.getWsgi()

if __name__ == "__main__":
    print("Serving application at http://localhost:8000")
    app.serve()