Properly set database connection string in cloud.gov

This commit is contained in:
Ryan Ahearn
2022-11-01 11:34:00 -04:00
parent 3ceda169f7
commit b4256d0a6c
4 changed files with 18 additions and 7 deletions

View File

@@ -14,6 +14,10 @@ class CloudfoundryConfig:
'region': ''
}
@property
def database_url(self):
return os.environ.get('DATABASE_URL', '').replace('postgres://', 'postgresql://')
@property
def redis_url(self):
try:

View File

@@ -87,7 +87,7 @@ class Config(object):
ROUTE_SECRET_KEY_2 = os.environ.get('ROUTE_SECRET_KEY_2', 'dev-route-secret-key-2')
# DB settings
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI')
SQLALCHEMY_DATABASE_URI = cloud_config.database_url
SQLALCHEMY_RECORD_QUERIES = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_POOL_SIZE = int(os.environ.get('SQLALCHEMY_POOL_SIZE', 5))