Skip to content

Commit

Permalink
fix: set defaults for Django environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ngurenyaga committed Jul 13, 2021
1 parent 5c8aa61 commit 4b28845
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 30 deletions.
22 changes: 0 additions & 22 deletions bin/post_compile

This file was deleted.

16 changes: 10 additions & 6 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = env.bool("DJANGO_DEBUG", False)
DEBUG = env.bool("DJANGO_DEBUG", default=False)
# Local time zone. Choices are
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# though not all of them may be available with every OS.
Expand All @@ -49,11 +49,11 @@
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
"default": {
"NAME": env.str("POSTGRES_DB", "mle"),
"USER": env.str("POSTGRES_USER", "user"),
"PASSWORD": env.str("POSTGRES_PASSWORD", "somesecret"),
"HOST": env.str("POSTGRES_HOST", "localhost"),
"PORT": env.str("POSTGRES_PORT", None),
"NAME": env.str("POSTGRES_DB", default="mle"),
"USER": env.str("POSTGRES_USER", default="user"),
"PASSWORD": env.str("POSTGRES_PASSWORD", default="somesecret"),
"HOST": env.str("POSTGRES_HOST", default="localhost"),
"PORT": env.str("POSTGRES_PORT", default=None),
"ENGINE": "django.db.backends.postgresql",
"ATOMIC_REQUESTS": True,
}
Expand Down Expand Up @@ -316,3 +316,7 @@

MAX_IMAGE_HEIGHT = 4320
MAX_IMAGE_WIDTH = 7680

# minimal django-compressor settings
COMPRESS_ENABLED = True
COMPRESS_OFFLINE = True
2 changes: 1 addition & 1 deletion config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
}
# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#internal-ips
INTERNAL_IPS = ["127.0.0.1", "10.0.2.2"]
if env("USE_DOCKER") == "yes":
if env("USE_DOCKER", default="no") == "yes":
import socket

hostname, addresses, ips = socket.gethostbyname_ex(socket.gethostname())
Expand Down
2 changes: 1 addition & 1 deletion config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env("DJANGO_SECRET_KEY")
SECRET_KEY = env("DJANGO_SECRET_KEY", default="this must be replaced")
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=[".savannahghi.org"])

Expand Down

0 comments on commit 4b28845

Please sign in to comment.