From efc0df8dfc30fbd4d97a74449a8f78952664fd56 Mon Sep 17 00:00:00 2001 From: Rabeea Emad Date: Mon, 7 Jun 2021 17:22:59 -0700 Subject: [PATCH] Changes to variable names due to Flexible Server Adding: SSL mode require. Removing: Full hostname. --- azuresite/production.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/azuresite/production.py b/azuresite/production.py index c24c91be..a34c5d64 100644 --- a/azuresite/production.py +++ b/azuresite/production.py @@ -21,17 +21,15 @@ STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') -# DBHOST is only the server name, not the full URL -hostname = os.environ['DBHOST'] - # Configure Postgres database; the full username is username@servername, # which we construct using the DBHOST value. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': os.environ['DBNAME'], - 'HOST': hostname + ".postgres.database.azure.com", - 'USER': os.environ['DBUSER'] + "@" + hostname, - 'PASSWORD': os.environ['DBPASS'] + 'HOST': os.environ['DBHOST'], + 'USER': os.environ['DBUSER'], + 'PASSWORD': os.environ['DBPASS'], + 'OPTIONS': {'sslmode': 'require'} } }