import psycopg2
import MySQLdb
from _mysql_exceptions import ProgrammingError as MySQLProgrammingError, OperationalError as MySQLOperationalError

from django.core.cache import cache

from .helpers import run_as_site

from raven.contrib.django.raven_compat.models import client


def create_postgres_database(database):
    conn = None

    try:
        conn = psycopg2.connect(
            dbname="postgres",
            host=database.host.hostname,