Postgres.app

The easiest way to get started with PostgreSQL on the Mac

Install the psycopg2 library with with pip install psycopg2 or add it to your pip requirements file.

Django

In your settings.py, add an entry to your DATABASES setting:

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql_psycopg2",
        "NAME": "[YOUR_DATABASE_NAME]",
        "USER": "[YOUR_USER_NAME]",
        "PASSWORD": "",
        "HOST": "localhost",
        "PORT": "",
    }
}

Flask

When using the Flask-SQLAlchemy extension you can add to your application code:

from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/[YOUR_DATABASE_NAME]'
db = SQLAlchemy(app)

SQLAlchemy

In your application code add:

from sqlalchemy import create_engine
engine = create_engine('postgresql://localhost/[YOUR_DATABASE_NAME]')