Changed dbname to database in the psycopg2 connection string.