diff options
Diffstat (limited to 'archweb.wsgi')
-rw-r--r-- | archweb.wsgi | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/archweb.wsgi b/archweb.wsgi new file mode 100644 index 00000000..20ec463e --- /dev/null +++ b/archweb.wsgi @@ -0,0 +1,39 @@ +#!/usr/bin/python +import os +import sys +import site + +base_path = os.path.dirname(os.path.realpath(__file__)) + +virtualenv_path = os.path.join(base_path, "env") +if os.path.isdir(virtualenv_path): + site.addsitedir(os.path.join(virtualenv_path, 'lib/python2.7/site-packages')) + sys.path.insert(0, base_path) + +os.environ['DJANGO_SETTINGS_MODULE'] = "settings" + +os.chdir(base_path) + +using_newrelic = False +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 + + 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 + +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() + +if using_newrelic: + application = newrelic.agent.wsgi_application()(application) |