From 57730e4917e29421adcbe32fa9f6a1aefd4a5c63 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 13 Jan 2013 20:17:16 -0600 Subject: Try 3 at getting the New Relic license key in Signed-off-by: Dan McGee --- archweb.wsgi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/archweb.wsgi b/archweb.wsgi index 0d1798ab..901ac98f 100644 --- a/archweb.wsgi +++ b/archweb.wsgi @@ -17,6 +17,11 @@ try: import newrelic.agent from newrelic.api.exceptions import ConfigurationError try: + key_path = os.path.join(base_path, "newrelic.key") + if os.path.exists(key_path): + with open(key_path) as keyfile: + key = keyfile.read().strip() + os.environ["NEW_RELIC_LICENSE_KEY"] = key newrelic.agent.initialize(os.path.join(base_path, "newrelic.ini")) using_newrelic = True except ConfigurationError: @@ -28,9 +33,4 @@ import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() if using_newrelic: - _application = application - def application(environ, start_response): - os.environ["NEW_RELIC_LICENSE_KEY"] = environ.get("NEW_RELIC_LICENSE_KEY", None) - return _application(environ, start_response) - application = newrelic.agent.wsgi_application()(application) -- cgit v1.2.3-55-g3dc8