PostgreSQL server for Django applications under Ubuntu

Written by
Date: 2013-05-09 17:47:13 00:00


Spanish

In case you are trying to install a Django application that may need a database, one really powerful is PostgreSQL, but to be able to use it, you firs need to install it.

Under Ubuntu these are the steps neede to acomplish that.

sudo apt-get install postgresql libpq-dev

Then the psycopg2 Python library.

sudo pip install psycopg2

or

sudo easy_install psycopg2

Finally in your settings.py or production.py add this (something like this)

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'db_name',                      
        'USER': 'db_user',
        'PASSWORD': 'db_user_password',
        'HOST': ''
    }
}

Now you are ready to run your app.