-
Notifications
You must be signed in to change notification settings - Fork 7
Using PostgreSQL as default database
This is a guide for setting PostgreSQL as your database. The current default as listed in the main project is MySQL.
Determine the environment in which you will be running LibreQDA (e.g., Linux, MacOS, Windows, etc.)
Download the appropriate version for your operating system (I'm currently using 9.6 for this tutorial)
Go to PostgreSQL's installation guide, select the correct version at the top of the page, and follow the instructions.
Note: You can also perform this setup using the PGAdminIII tool. You can change the PASSWORD
variable to a value of your choice.
At the terminal, type sudo su - postgres
to access the postgres user
Type psql
to enter the PostgreSQL CLI
To create the database, type CREATE DATABASE libreqda;
To create the user, type CREATE USER libreqda_rw WITH PASSWORD 'libreqda';
To allow our new user to create and manipulate tables in the database, type:
ALTER ROLE libreqda_rw SET client_encoding TO 'utf8';
ALTER ROLE libreqda_rw SET default_transaction_isolation TO 'read committed';
ALTER ROLE libreqda_rw SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE libreqda TO libreqda_rw;
Exit PostgreSQL by typing \q
Exit the shell by typing exit
Ensure your local_settings.py DATABASE
section reads as:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'libreqda',
'USER': 'libreqda_rw',
'PASSWORD': 'libreqda',
'HOST': 'localhost',
'PORT': '',
}
}