Skip to content

Instantly share code, notes, and snippets.

from pymongo.connection import Connection , ConnectionFailure
import datetime
try:
connection = Connection("localhost", 27017)
except ConnectionFailure:
page_content = """<span class = "error">could not connect connect:besure that Mongo is running on localhost:27017</span>"""
except Exception, detail:
page_content = """<span class = "error">could not connect connect:besure that Mongo is running on localhost:27017</span>"""
from pymongo.connection import Connection , ConnectionFailure
import datetime
try:
connection = Connection("localhost", 27017)
except ConnectionFailure:
page_content = """<span class = "error">could not connect connect:besure that Mongo is running on localhost:27017</span>"""
except Exception, detail:
page_content = """<span class = "error">could not connect connect:besure that Mongo is running on localhost:27017</span>"""