From a64628e3bb3593cbb547c2dd36ceb83352d10f64 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Mon, 26 Apr 2021 09:53:17 +0900 Subject: [PATCH] Replace postgres url for heroku, fix #1327 --- backend/app/settings.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/app/settings.py b/backend/app/settings.py index 5df89e66..9c4d59f0 100644 --- a/backend/app/settings.py +++ b/backend/app/settings.py @@ -353,7 +353,12 @@ try: CELERY_BROKER_URL = env('CELERY_BROKER_URL') except EnvError: try: - CELERY_BROKER_URL = 'sqla+{}'.format(env('DATABASE_URL')) + # quickfix for Heroku. + # See https://github.com/doccano/doccano/issues/1327. + uri = env('DATABASE_URL') + if uri.startswith('postgres://'): + uri = uri.replace('postgres://', 'postgresql://', 1) + CELERY_BROKER_URL = 'sqla+{}'.format(uri) except EnvError: CELERY_BROKER_URL = 'sqla+sqlite:///{}'.format(DATABASES['default']['NAME']) CELERY_ACCEPT_CONTENT = ['application/json']