Installation with PostgreSQL

These instructions provide additional steps for setting up Pootle with PostgreSQL.

You should read the full installation instructions in order to install Pootle.

Setting up the database

As the postgres user you must create a database and database user:

$ sudo su postgres  # On Ubuntu, may be different on your system
postgres@ $ createuser -P pootle  # This will ask you to define the users password.
postgres@ $ createdb --encoding='utf8' --locale=en_US.utf8 --template=template0 --owner=pootle pootledb

System software requirements

In addition to the system packages set out in the general installation requirements you will also require the PostgreSQL client development headers in order to build the Python bindings, e.g. on Debian Jessie:

$ sudo apt-get install postgresql-server-dev-9.4

Installing PostgreSQL Python bindings

Once you have set up and activated your virtual environment, you will need to install the PostgreSQL bindings.

You can do so as follows:

(env) $ pip install psycopg2

Initializing the Configuration

When initializing your configuration you can specify params to set up your database, e.g.:

(env) $ pootle init --db postgresql --db-name pootledb --db-user pootle

This will create a configuration file to connect to a PostgreSQL database named pootledb hosted on localhost as the user pootle. Please see the init command for all of the available options.

You will most likely want to edit your Pootle configuration (default location: ~/.pootle/pootle.conf) to set your password.

Database backend

Please note that Pootle uses django-transaction-hooks backends for connecting to the database. For PostgreSQL the correct ENGINE to set for the backend is:

DATABASES = {
    'default': {
        'ENGINE': 'transaction_hooks.backends.postgresql_psycopg2',
        ...
    }
}