[Answered ]-Setup Django Postgres database

2👍

Bitbucket is used to host your source code, not your database data.

If you setup a local database, only you, will be able to access these data. If you setup a remote database, you and your teammates will be able to access data. But it’s absolutely not recommended during development because each person are not working on the same task and database migration can mess up the work of one of your colleagues.

If you want share data and populate your database during development, you are searching fixtures : Django Wiki – Fixture

Fixtures files are a good way to share data to populate your database. Theses files can be versioned on Bitbucket.

0👍

Step: 1

pip install psycopg2

For mac if you can’t install or the above command doesn’t work, use the following command instead, just add — binary

pip install psycopg2-binary

Step: 2 settings.py add configuration.

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'db_name', 
    'USER': 'db_user', 
    'PASSWORD': 'db_password',
    'HOST': '127.0.0.1', # DB host
    'PORT': '5432', # DB port
}

}

Leave a comment