Closed sadan closed 5 years ago
The solution is to disable the automatic configuration of the databases in django-heroku
by passing in databases=False
to the settings function and configuring the database settings yourself. The docs mention to put this
# Activate Django-Heroku.
django_heroku.settings(locals())
at the bottom of your settings file. But instead you could do something like this:
# Activate Django-Heroku without database setup.
config = locals()
django_heroku.settings(config, databases=False)
# Manual configuration of database
import dj_database_url
conn_max_age = config.get('CONN_MAX_AGE', 600) # Used in django-heroku
config['DATABASES'] = {
'default': dj_database_url.parse(
os.environ['DATABASE_URL'],
engine='tenant_schemas.postgresql_backend'
conn_max_age=conn_max_age,
ssl_require=True
)
}
Thank you so much @jeroenbrouwer
figured it out to some extent but this is helpful as well.
I am workin on a tenants based application and want to use Heroku free tier for testing purpose.
Right now I can't figure out a way to configure the database on Heroku. The official documentation says to use django-heroku, but how would I change the database engine to
tenant_schemas.postgresql_backend
. Can someone suggest something?