Skip to content

Instantly share code, notes, and snippets.

@adamshamsudeen
Last active December 9, 2019 15:24
Show Gist options
  • Save adamshamsudeen/072c7e73ef4e5db8c9c4d95f1ef50ece to your computer and use it in GitHub Desktop.
Save adamshamsudeen/072c7e73ef4e5db8c9c4d95f1ef50ece to your computer and use it in GitHub Desktop.
postgress setup on ubuntu for django
sudo apt-get install libpq-dev postgresql postgresql-contrib
sudo -u postgres -i
psql
create database tagger;
create user tagger_user with password 'passsss';
grant all privileges on database tagger to tagger_user;
ALTER ROLE tagger_user SET client_encoding TO 'utf8';
ALTER ROLE tagger_user SET default_transaction_isolation TO 'read committed';
ALTER ROLE tagger_user SET timezone TO 'UTC';
sudo -u postgres psql tagger -c "GRANT ALL ON ALL TABLES IN SCHEMA public to tagger_user;"
sudo -u postgres psql tagger -c "GRANT ALL ON ALL SEQUENCES IN SCHEMA public to tagger_user;"
sudo -u postgres psql tagger -c "GRANT ALL ON ALL FUNCTIONS IN SCHEMA public to tagger_user;"
@adamshamsudeen
Copy link
Author

To give access to the db
/etc/postgresql/9.3/main
You have to edit postgresql.conf file and change line with 'listen_addresses'.
listen_addresses = '*'
then added to top of directives in pg_hba.conf file host all all 0.0.0.0/0 md5
Restart psql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment