-
Notifications
You must be signed in to change notification settings - Fork 6
Postgres Tutorial
Lauren Johnston edited this page May 9, 2020
·
1 revision
Taken from https://medium.com/agatha-codes/painless-postgresql-django-d4f03364989.
- Install required requirements
pip install -r requirements.txt
. - Install PostgreSQL from: https://postgresapp.com/downloads.html. Choose the first download option: Postgres.app with PostgreSQL 11. If you don't already have postgres, do "brew install postgres".
- Make sure to start a Postgres server. Use the default settings on Port 5432.
- Create a Postgres user with the DISTR_DB_USER, a database with DISTR_DB_NAME, and password DISTR_DB_PASS.
- Create the database from the command line:
# open postgres
psql postgres
CREATE DATABASE <DISTR_DB_NAME>;
CREATE USER <DISTR_DB_USER> WITH encrypted password <DISTR_DB_PASS>;
GRANT ALL PRIVILEGES ON DATABASE <DISTR_DB_NAME> to <DISTR_DB_USER>;
- Add the following to your bash_profile:
# Representable Stuff
export DISTR_DB_NAME="..."
export DISTR_DB_USER="..."
export DISTR_DB_PASS="..."
And then Ctrl^x and press Y to exit.
-
Restart the bash terminal for changes to go into effect.
-
You can now run
python manage.py runserver
without issues!