From 20c6da375e2c4776819de61c0950ac4808429808 Mon Sep 17 00:00:00 2001 From: James Polley Date: Sat, 30 Jun 2018 09:37:30 +1000 Subject: [PATCH] If ANALYTICS_KEY in the environment, enable gAnalytics --- k8s/deployment_template.jsonnet | 4 ++++ pinaxcon/settings.py | 8 ++++++++ pinaxcon/templates/site_base.html | 20 +++++++++++++------- pinaxcon/templatetags/lca2018_tags.py | 1 - requirements.txt | 3 ++- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/k8s/deployment_template.jsonnet b/k8s/deployment_template.jsonnet index 7719d7f1..3d2548a8 100644 --- a/k8s/deployment_template.jsonnet +++ b/k8s/deployment_template.jsonnet @@ -105,6 +105,10 @@ function (slug, sha) { "name": "SYMPOSION_DEV_MODE", "value": "LAPTOP" }, + { + "name": "ANALYTICS_KEY", + "value": "UA-000000000-1" + } ], "image": "asia.gcr.io/linuxconfsydney/symposion_app_2019_dev:" + sha, "imagePullPolicy": "Always", diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index 233bdec0..d8ef7f0a 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -47,6 +47,8 @@ PINAX_STRIPE_PUBLIC_KEY = os.environ.get('STRIPE_PUBLIC_KEY', None) PINAX_STRIPE_SECRET_KEY = os.environ.get('STRIPE_SECRET_KEY', None) PINAX_STRIPE_SEND_EMAIL_RECEIPTS = False +ANALYTICS_KEY = os.environ.get('ANALYTICS_KEY', None) + saml2_entityid = os.environ.get('SAML2_ENTITYID', None) saml2_sp_name = os.environ.get('SAML2_SP_NAME', None) saml2_sp_assertion_service = os.environ.get('SAML2_SP_ASSERTION_SERVICE', None) @@ -150,6 +152,7 @@ TEMPLATES = [ "django.contrib.messages.context_processors.messages", "pinax_theme_bootstrap.context_processors.theme", "symposion.reviews.context_processors.reviews", + "django_settings_export.settings_export", ], }, }, @@ -415,6 +418,11 @@ GAPC_STORAGE = { 'num_retries': 2, } +SETTINGS_EXPORT = [ + 'DEBUG', + 'ANALYTICS_KEY', +] + if DEV_MODE and DEV_MODE == "LAPTOP": print("ENABLING LAPTOP MODE") from .devmode_settings import * diff --git a/pinaxcon/templates/site_base.html b/pinaxcon/templates/site_base.html index 5d33d909..12ac14b8 100644 --- a/pinaxcon/templates/site_base.html +++ b/pinaxcon/templates/site_base.html @@ -11,13 +11,6 @@ - - @@ -88,6 +81,19 @@ + {% if settings.ANALYTICS_KEY %} + + + + {% else %} + + {% endif %} {% block extra_script %} {% endblock %} {% block scripts_extra %}{% endblock %} diff --git a/pinaxcon/templatetags/lca2018_tags.py b/pinaxcon/templatetags/lca2018_tags.py index f6458925..8620bc10 100644 --- a/pinaxcon/templatetags/lca2018_tags.py +++ b/pinaxcon/templatetags/lca2018_tags.py @@ -141,4 +141,3 @@ def ticket_type(context): # Default to product type return ticket_type - diff --git a/requirements.txt b/requirements.txt index 64d2d1d7..c9ec5a51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,6 +7,7 @@ dj-database-url==0.4.2 pylibmc==1.5.1 django-debug-toolbar>=1.7 django-bootstrap-form +django-settings-export~=1.2.1 djangosaml2 django-gapc-storage>=0.4.1 @@ -50,4 +51,4 @@ libsass==0.14.5 django-sass-processor==0.7 django-compressor==2.2 -django-crispy-forms \ No newline at end of file +django-crispy-forms