diff --git a/.env.example b/.env.example index 5cf1e4ccbcfc765d8b7eaedca9d7ed35b24c4fd5..8977349c5bd7350bea0b06af9904796f4ab29554 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 899731df47e50d6d82ab39ffd71eaf7cbd20e14f..365d775513ab97978ee724ff3bd0c68ac1fe3d51 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://'