aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2017-10-31 22:53:29 -0400
committerMitch Riedstra <mitch@riedstra.us>2017-10-31 22:53:29 -0400
commitb7d282a8ba5f0ed6c773989c96c2182257cc69a5 (patch)
tree49c8047397a194fa608c629b883193a164890b64 /app
parent4b191cb3d2c0502088e396a71147e0423e6ecb90 (diff)
downloaddispatch-tracker-b7d282a8ba5f0ed6c773989c96c2182257cc69a5.tar.gz
dispatch-tracker-b7d282a8ba5f0ed6c773989c96c2182257cc69a5.tar.xz
Some changes to make deployment easier
Diffstat (limited to 'app')
-rw-r--r--app/app/settings.py23
-rw-r--r--app/config.yml10
-rw-r--r--app/uwsgi.ini2
3 files changed, 32 insertions, 3 deletions
diff --git a/app/app/settings.py b/app/app/settings.py
index d472675..f143931 100644
--- a/app/app/settings.py
+++ b/app/app/settings.py
@@ -16,20 +16,37 @@ import yaml
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-CONFIG = yaml.load(open(BASE_DIR + '/config.yml').read())
+
+def get_default_config():
+ return yaml.load(open(BASE_DIR + '/config.yml').read())
+
+
+CONFIG = {}
+
+if os.environ.get('CUSTOM_CONFIG'):
+ try:
+ fn = "{}/{}".format(BASE_DIR, os.environ.get('CUSTOM_CONFIG'))
+ CONFIG = yaml.load(open(fn))
+ except Exception as e:
+ print("WARNING: Loading default configuration. \n{}".format(e))
+ CONFIG = get_default_config()
+else:
+ CONFIG = get_default_config()
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = 'h$r_bwlp@#h#y#%&qhw-n=gb2%wva1d_h65+o94u&!a#%iv&lo'
+SECRET_KEY = CONFIG['SECRET_KEY']
# SECURITY WARNING: don't run with debug turned on in production!
-DEBUG = True
+DEBUG = CONFIG['debug']
ALLOWED_HOSTS = CONFIG['allowed_hosts']
+ADMINS = CONFIG['admins']
+
# Application definition
diff --git a/app/config.yml b/app/config.yml
index 66ac993..8c39278 100644
--- a/app/config.yml
+++ b/app/config.yml
@@ -25,3 +25,13 @@ allowed_hosts:
- 127.0.0.1
static_root: '/full/path/to/static/root'
+
+debug: True
+
+# CHANGE THIS BEFORE USING IN PRODUCTION
+SECRET_KEY: 'h$r_bwlp@#h#y#%&qhw-n=gb2%wva1d_h65+o94u&!a#%iv&lo'
+
+# These people will be emailed if debug = false
+admins:
+ - 'bob@example.com'
+
diff --git a/app/uwsgi.ini b/app/uwsgi.ini
index 5b7b516..829d185 100644
--- a/app/uwsgi.ini
+++ b/app/uwsgi.ini
@@ -2,6 +2,8 @@
processes = 1
threads = 4
+env = CUSTOM_CONFIG=config.yml
+
socket = 127.0.0.1:9200
module = wsgi:application