예제 #1
0
파일: __init__.py 프로젝트: dnjsakf/flask
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
예제 #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')