Try 3 at getting the New Relic license key in
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
8986be44be
commit
57730e4917
10
archweb.wsgi
10
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)
|
||||
|
Loading…
Reference in New Issue
Block a user