From 3135f6c510f5c3943e1a20ed8edcfc652813d214 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 1 Feb 2016 14:46:12 +0000 Subject: [PATCH] Use different colours for each environment https://www.pivotaltracker.com/story/show/112786779 > There's an emerging convention on admin apps, to have a red strip atop the > page, also to have a different colour for preview environment... so let's > adopt that and see how it feels. Red for prod and gold for preview. This commit adds config so that: - yellow locally - orange on preview and staging - red on live It will not actually work until each AWS environment uses the right config, but can be tested locally by setting the environment variable manually, eg: `export HEADER_COLOUR='#F47738'` --- app/__init__.py | 5 ++++- app/templates/admin_template.html | 3 +++ config.py | 13 ++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index ad7bb99c1..3092d4114 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -100,7 +100,10 @@ def init_app(app, config_overrides): @app.context_processor def inject_global_template_variables(): - return {'asset_path': '/static/'} + return { + 'asset_path': '/static/', + 'header_colour': app.config['HEADER_COLOUR'] + } def convert_to_boolean(value): diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index 3bf9b2491..9624ca741 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -5,6 +5,9 @@ + diff --git a/config.py b/config.py index e8d51e092..b2725fbf1 100644 --- a/config.py +++ b/config.py @@ -39,6 +39,8 @@ class Config(object): MAX_CONTENT_LENGTH = 10 * 1024 * 1024 # 10mb UPLOAD_FOLDER = '/tmp' + HEADER_COLOUR = '#FFBF47' # $yellow + class Development(Config): DEBUG = True @@ -53,10 +55,19 @@ class Test(Development): WTF_CSRF_ENABLED = False -class Live(Config): +class Preview(Config): DEBUG = False HTTP_PROTOCOL = 'https' SESSION_COOKIE_SECURE = True + HEADER_COLOUR = '#F47738' # $orange + + +class Staging(Preview): + pass + + +class Live(Staging): + HEADER_COLOUR = '#B10E1E' # $red configs = {