Esempio n. 1
0
def createApp(env='dev'):
    envConfFile = os.path.join(os.path.dirname(__file__), 'config/env', '.env')
    envConf = dotenv.load_dotenv(dotenv_path=envConfFile)
    app.config.from_object(envConf)

    pyConfFile = os.path.join(os.path.dirname(__file__), 'config/env',
                              f'env.{env}.py')
    app.config.from_pyfile(pyConfFile)

    if 'CORS' in app.config:
        CORS(app=app, resources=app.config['CORS'])

    app.config['database'] = DB.connect()

    return app
Esempio n. 2
0
        },
        {
            '$limit': 20
        },
        {
            '$sort': {
                'no': -1
            }
        }
    ]

    cursor = client.test.test.aggregate(pipeline=pipe)

    from pprint import pprint

    print(cursor)


# tester()

DB.connect(retry=5)


@DB.transaction('test')
def getDataList(client, session):
    data = client.test.aggregate()

    pprint(list(data))


getDataList(pipeline='insertGetData')