I am trying to learn a bit of pgbouncer with postgres and django - but I seem to have a problem when under production.
So, I have a django site say site1
, which uses the following django database settings.py
:
SECRET_KEY = "dbpassword"
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'site1db1',
'USER': 'postgres',
'PASSWORD': SECRET_KEY,
'HOST': 'localhost',
'PORT': '12517', # custom pgbouncer post
}
}
the above works all fine with site1
- and this is running live on production. Now, I introduce another django site (separate django installation) called site2
with a new database site2db2
. So, at the moment, I have my settings.py for site2
in django as follows:
SECRET_KEY = "dbpassword"
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'site2db2',
'USER': 'postgres',
'PASSWORD': SECRET_KEY,
'HOST': 'localhost',
'PORT': '12517', # custom pgbouncer post
}
}
unfortunately, when I try to syncdb
this second django site, I get;
django.db.utils.OperationalError: ERROR: Auth failed
I am assuming that this is because site1
is using the same port as site2
? How does one get around this problem. Any guidance pointing me to the right direction would be great.