from pymongo.connection import Connection
from bson.objectid import ObjectId
import os

db = None

def get_connection():
    global db

    if db == None:
        print "Conectando ao Mongo"
        connection = Connection('NOTES_MONGO_HOST')

        try:
            env = os.environ["NOTES_ENV"]
        except:
            env = "test"

        if env == "production":
            db = connection['notes_prod']
        else:
            db = connection['notes_test']

    return db



7d6bab6e448545c25ab23f1109cf0ea5b6c14456
from pymongo.connection import Connection
from bson.objectid import ObjectId
import os

db = None

def get_connection():
    global db

    if db == None:
        print "Conectando ao Mongo"
        connection = Connection('NOTES_MONGO_HOST')

        try:
            env = os.environ["NOTES_ENV"]
        except:
            env = "test"

        if env == "production":
            db = connection['notes_prod']
        else:
            db = connection['notes_test']

    return db


