aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/util.py
blob: 56f22d7ea864038d6ec3585fa428b0ffe378b662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import mongokit
from pymongo import DESCENDING
from mongokit import ObjectId


def connect_database(app_config):
    """Connect to the main database, take config from app_config"""
    port = app_config.get('db_port')
    if port:
        port = asint(port)
    connection = mongokit.Connection(
        app_config.get('db_host'), port)
    return connection