[PATCH v2 2/3] Default dev settings, set host to empty (unix socket) on postgresql

Daniel Black daniel at linux.ibm.com
Mon Aug 6 16:56:38 AEST 2018


An empty environment variable resulted in localhost, meaning
posgresql connecting to domain sockets wasn't available.

Signed-off-by: Daniel Black <daniel at linux.ibm.com>
---
 .travis.yml               | 3 +++
 patchwork/settings/dev.py | 1 +
 2 files changed, 4 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 58e0b08..0c6e79d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,6 +22,7 @@ env:
     - PW_TEST_DB_TYPE=mysql PW_TEST_DB_USER=root
   global:
     - PW_TEST_DB_PASS=""
+    - PW_TEST_DB_HOST="localhost"
 
 matrix:
   include:
@@ -33,6 +34,7 @@ matrix:
           - postgresql-client-10
       env:
         - PGPORT=5433
+        - PW_TEST_DB_HOST=""
         - PW_TEST_DB_PORT=5433
         - PW_TEST_DB_TYPE=postgres
         - PW_TEST_DB_USER=travis
@@ -43,6 +45,7 @@ matrix:
         - sudo -u postgres psql -c "grant ALL on DATABASE postgres to travis WITH GRANT OPTION;"
     - env:
         - PGPORT=5433
+        - PW_TEST_DB_HOST=""
         - PW_TEST_DB_PORT=5433
         - PW_TEST_DB_TYPE=postgres
         - PW_TEST_DB_USER=travis
diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
index 7bdfdff..0f79b61 100644
--- a/patchwork/settings/dev.py
+++ b/patchwork/settings/dev.py
@@ -41,6 +41,7 @@ DATABASES = {
 
 if os.getenv('PW_TEST_DB_TYPE', None) == 'postgres':
     DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
+    DATABASES['default']['HOST'] = os.getenv('PW_TEST_DB_HOST', '')
 
 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
 
-- 
2.17.1



More information about the Patchwork mailing list