Documented by kbruder tech✞ᵀᵀᴹ on Oct 08, 2020
Last updated on Mar 22, 2021
In this example we will switch to the Postgres user which was created when Postgesql 10 was installed. Make sure Postgresql 10 is installed before proceeding. It's a good idea to open a new terminal then log out and close it after the database configuration is confirmed to be working.
Use the following commands to enter the Postgres command line interface
$ sudo -u postgres psql
Use the following commands in the Postgres CLI to create a new database.
postgres=# create database lookaway;
Use the following command in the Postgres CLI to create a Lookaway database role.
postgres=# create role lookaway;
Use the following command on the Postgres CLI to authorize the Lookaway role to use the database.
postgres=# grant all privileges on database lookaway to lookaway; postgres=# alter role lookaway with encrypted password '<PASSWORD>'; postgres=# alter role lookaway with login; postgres=# alter role lookaway createdb;
Follow Django's own recommendations for using PostgreSQL
postgres=# alter role lookaway set client_encoding to 'utf8'; postgres=# alter role lookaway set default_transaction_isolation to 'read committed'; postgres=# alter role lookaway set timezone to 'UTC';
Django needs the following parameters for its database connections:
default_transaction_isolation: 'read committed' by default, or the value set in the connection options (see below),
when USE_TZ is True, 'UTC' by default, or the TIME_ZONE value set for the connection,
when USE_TZ is False, the value of the global TIME_ZONE setting.
If these parameters already have the correct values, Django won’t set them for every new connection, which improves performance slightly. You can configure them directly in postgresql.conf or more conveniently per database user with ALTER ROLE.
Django will work just fine without this optimization, but each new connection will do some additional queries to set these parameters.
Use the following command to quit the Postgres CLI then close the terminal.
Now Postgresql is setup to allow Lookaway CMS to read and write its own database and create new ones for testing purposes.
Learn how to deploy Lookaway CMS onto a public webserver using Ubuntu 20.04 and PostgreSQL 10.
This document explains how to recover your Lookaway CMS powered website from backup data.
Learn how to initialize all of the modules, files, and configurations for a fresh production Lookaway CMS installation on a server running Ubuntu Server 20
Please donate some Bitcoin to our site. We can use it to keep improving the site and open up to more members. Any amount will help. Thank you.
Please donate some Lite to our site. We can use it to keep improving the site and open it up to more members. Any amount will help. Thank you.