I sometimes use the chalisque.net pages like an online public notebook. Many 'instruction' pages like this are terse, compiled from the various tutorials I have looked through. For someone with basic familiarity, they tend to be all you need to remember once you have grasped what they are about, but for a thorough tutorial do look elsewhere. With regards to best practice and security issues, be aware that these notes are for a machine on which I am experimenting with ideas, rather than any kind of production system, so I don't bother with security and scalability until I have a production-worthy idea that needs to scale (or be secure).

Sources:

Install

I use
sudo apt-get install -y postgresql-{9.5,9.5-{pllua,plv8},{server-dev,client,doc,contrib}-9.5}
sudo pip install psycopg2 pyquery pquery
sudo pip3 install psycopg2 pyquery

Initial stuff

Create a database and let my user access it. These need to be done as the user postgres.
sudo -u postgres createdb db1
Connect to the new database (as user postgres at first)
sudo -u postgres psql
Create a database user for myself ('myself' is a dummy username)
CREATE USER myself WITH PASSWORD 'MrFlibble';
Allow myself to access it
GRANT ALL PRIVILEGES ON DATABASE db1 to myself;
or
ALTER DATABASE db1 OWNER TO myself;

Basic sql

Caveat: these lines are not intended to be run in the following order. They are just a bunch of useful sql statements stuck together for convenience.
create table t1 (...);
# example fields

{{{