'Setup Django Postgres database

I created the django app, I have it connected to my local server with pgAdmin3. I want to have the django app push to bitbucket. But the problem is:

How do I setup Postgres database, so that everything I commit and push, my group member can pull and have the same data?



Solution 1:[1]

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.

Solution 2:[2]

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
}

}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Louis Barranqueiro
Solution 2 Bozlur Rosid Sagor