diff --git a/app/app/settings.py b/app/app/settings.py index 7a358791..740405ee 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -62,6 +62,7 @@ MIDDLEWARE = [ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'social_django.middleware.SocialAuthExceptionMiddleware', + 'applicationinsights.django.ApplicationInsightsMiddleware', ] ROOT_URLCONF = 'app.urls' @@ -185,6 +186,9 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') IMPORT_BATCH_SIZE = 500 GOOGLE_TRACKING_ID = os.getenv('GOOGLE_TRACKING_ID', 'UA-125643874-2') -AZURE_APPINSIGHTS_IKEY = os.getenv('AZURE_APPINSIGHTS_IKEY') + +APPLICATION_INSIGHTS = { + 'ikey': os.getenv('AZURE_APPINSIGHTS_IKEY'), +} django_heroku.settings(locals(), test_runner=False) diff --git a/app/server/templatetags/analytics.py b/app/server/templatetags/analytics.py index a623cb71..c1fa1a50 100644 --- a/app/server/templatetags/analytics.py +++ b/app/server/templatetags/analytics.py @@ -14,5 +14,5 @@ def google_analytics(): def azure_appinsights(): return { 'DEBUG': settings.DEBUG, - 'azure_appinsights_ikey': settings.AZURE_APPINSIGHTS_IKEY, + 'azure_appinsights_ikey': settings.APPLICATION_INSIGHTS['ikey'], } diff --git a/requirements.txt b/requirements.txt index e931cc8f..4d120b3e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +applicationinsights==0.11.7 dj-database-url==0.5.0 Django==2.1.5 django-filter==2.0.0