summaryrefslogtreecommitdiffstats
path: root/archweb.wsgi
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-01-13 20:17:16 -0600
committerDan McGee <dan@archlinux.org>2013-01-13 20:17:16 -0600
commit57730e4917e29421adcbe32fa9f6a1aefd4a5c63 (patch)
treeefadfc9954ad71a9145ca0fc7585709fa3ed477a /archweb.wsgi
parent8986be44be8ed8778e30fc144a2bc76febc11c6d (diff)
downloadarchweb-57730e4917e29421adcbe32fa9f6a1aefd4a5c63.tar.gz
archweb-57730e4917e29421adcbe32fa9f6a1aefd4a5c63.zip
Try 3 at getting the New Relic license key in
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'archweb.wsgi')
-rw-r--r--archweb.wsgi10
1 files 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)