From 4eb41ea166012de9e4fa102efc957acb0bfce023 Mon Sep 17 00:00:00 2001
From: jackie / Andrea Ida Malkah Klaura <jackie@diebin.at>
Date: Sat, 10 Apr 2021 09:53:59 +0200
Subject: [PATCH] adapt settings for docker setup; remove debug line

---
 .env.example   | 4 ++--
 pv/settings.py | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.env.example b/.env.example
index 5cf1e4cc..8977349c 100644
--- a/.env.example
+++ b/.env.example
@@ -21,7 +21,7 @@ SECRET_KEY=put-something-awesomely-random-here
 # if you use a dev environment where django is not running inside a docker
 # container, but you use the postgres container for the db and map its port,
 # then use localhost as the database hostname
-# (default host: steering-postgres)
+# (default host: steering-postgres ; or if RUN_IN_DOCKER is False: localhost)
 # (default port: 5432)
 # (default name: steering)
 # (default user: steering)
@@ -47,7 +47,7 @@ DBPASS=change-to-something-secure
 # database in its container, but run the steering dev server directly on your
 # host. In this case make this False.
 # (default: True)
-#RUNINDOCKER=
+#RUN_IN_DOCKER=
 
 # This should be turned on only for your development environment unless you
 # know exactly what you are doing and what the consequences are.
diff --git a/pv/settings.py b/pv/settings.py
index 899731df..365d7755 100644
--- a/pv/settings.py
+++ b/pv/settings.py
@@ -22,9 +22,8 @@ ROOT_URLCONF = 'pv.urls'
 
 env = environ.Env()
 env.read_env(env_file=PROJECT_DIR+'/../.env')
-env.str('DBHOST')
 
-DOCKER = env.bool('DOCKER', default=True)
+DOCKER = env.bool('RUN_IN_DOCKER', default=True)
 DEBUG = env.bool('DEBUG', default=False)
 SITE_ID = 1
 ADMINS = ()
@@ -69,6 +68,8 @@ DATABASES = {
     #        },
     #   },
 }
+if not DOCKER:
+    DATABASES['default']['HOST'] = env.str('DBHOST', default='localhost')
 
 CACHE_BACKEND = 'locmem://'
 
-- 
GitLab