Пример #1
0
def remove_test_database():
    from pyramid_mongokit import SingleDbConnection
    connection = SingleDbConnection(
        os.environ['MONGO_DB_NAME'],
        '',
        os.environ['MONGO_URI']
        )
    connection.drop_database(os.environ['MONGO_DB_NAME'])
Пример #2
0
def new_connection():
    from example.model import User, Photo
    db_prefix = ''
    connection = SingleDbConnection(os.environ['MONGO_DB_NAME'], db_prefix,
                                    os.environ['MONGO_URI'])
    connection.register(User)
    connection.register(Photo)
    connection.generate_index(User)
    connection.generate_index(Photo)
    return connection