diff options
Diffstat (limited to 'archweb.wsgi')
-rw-r--r-- | archweb.wsgi | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/archweb.wsgi b/archweb.wsgi index abe5419a..6fac21e9 100644 --- a/archweb.wsgi +++ b/archweb.wsgi @@ -3,12 +3,29 @@ import os import sys import site +base_path = "/srv/http/archweb" + site.addsitedir('/srv/http/archweb-env/lib/python2.7/site-packages') -sys.path.insert(0, "/srv/http/archweb") +sys.path.insert(0, base_path) os.environ['DJANGO_SETTINGS_MODULE'] = "settings" -os.chdir("/srv/http/archweb") +os.chdir(base_path) + +using_newrelic = False +try: + import newrelic.agent + from newrelic.api.exceptions import ConfigurationError + try: + newrelic.agent.initialize(os.path.join(base_path, "newrelic.ini")) + using_newrelic = True + except ConfigurationError: + pass +except ImportError: + pass import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() + +if using_newrelic: + application = application = newrelic.agent.wsgi_application()(application) |