I have a Django application deployed to Heroku and Postgres, I'm trying to add pgbouncer to scale the app a bit, but I'm getting this error:
django.db.utils.OperationalError: server does not support SSL, but SSL was required
as a lot of other questions say, the problem is the SSL in django-heroku package. So I tried to approaches, first: adding to the end of setting file the following:
del DATABASES['default']['OPTIONS']['sslmode']
the error is still being raised, so I took django-heroku settings function and modified it to disable SSL directly in there
def custom_settings(config, *, db_colors=False, databases=True, test_runner=True, staticfiles=True, allowed_hosts=True,
logging=True, secret_key=True):
# Database configuration.
# TODO: support other database (e.g. TEAL, AMBER, etc, automatically.)
# Same code as the package
# CHANGING SSL TO FALSE
config['DATABASES'][db_color] = dj_database_url.parse(url, conn_max_age=MAX_CONN_AGE,
ssl_require=False)
if 'DATABASE_URL' in os.environ:
logger.info('Adding $DATABASE_URL to default DATABASE Django setting.')
# Configure Django for DATABASE_URL environment variable.
config['DATABASES']['default'] = dj_database_url.config(conn_max_age=MAX_CONN_AGE, ssl_require=False)
logger.info('Adding $DATABASE_URL to TEST default DATABASE Django setting.')
and calling it:
django_heroku_override.custom_settings(config=locals(), staticfiles=False, logging=False)
but that didn't work as well, I'm still getting the original error
adding Procfile just for complicity:
web: bin/start-pgbouncer daphne rivendell.asgi:application --port $PORT --bind 0.0.0.0 -v2
worker: python manage.py runworker channel_layer -v2