Skip to content

Latest commit

 

History

History
39 lines (35 loc) · 1022 Bytes

File metadata and controls

39 lines (35 loc) · 1022 Bytes

Create Postgresql database for django application

Install Prerequisites

sudo apt-get update
sudo apt-get install python-pip python-dev libpq-dev postgresql postgresql-contrib

Create Database commands

# Enter psql shell
sudo su - postgres
psql
# create database
CREATE DATABASE <dbname>;
# create user
CREATE USER <dbuser> WITH PASSWORD <'password'>;
# configuration for django to increse efficiency
ALTER ROLE <dbuser> SET client_encoding TO 'utf8';
ALTER ROLE <dbuser> SET default_transaction_isolation TO 'read committed';
ALTER ROLE <dbuser> SET timezone TO 'UTC';
# grant privileges
GRANT ALL PRIVILEGES ON DATABASE <dbname> TO <dbuser>;
# exit psql shell
\q
exit

For more details

How To Use PostgreSQL with your Django Application