summaryrefslogtreecommitdiff
path: root/archweb.wsgi
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-04-22 00:36:57 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-04-22 00:36:57 -0400
commitdf7a6aa620af6a165bdacd755757f8cb1179331c (patch)
tree384b4c62d1f50d8effb733d81d2a810666807624 /archweb.wsgi
parent94f972bb892dbf9a86f089f1872ae6d849c0cd0e (diff)
parenta22557811a24b68ef85d4271787c48d8d1e4fc99 (diff)
Merge branch 'archweb-generic2'
Conflicts: README.BRANDING local_settings.py.example packages/templatetags/package_extras.py public/views.py releng/views.py settings.py sitestatic/archnavbar/archnavbar.css sitestatic/silhouette.png templates/base.html templates/packages/differences.html templates/packages/opensearch.xml templates/packages/search.html templates/public/donate.html templates/public/download.html templates/public/feeds.html templates/public/index.html urls.py
Diffstat (limited to 'archweb.wsgi')
-rw-r--r--archweb.wsgi37
1 files changed, 37 insertions, 0 deletions
diff --git a/archweb.wsgi b/archweb.wsgi
new file mode 100644
index 00000000..f8de2b49
--- /dev/null
+++ b/archweb.wsgi
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+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, 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
+
+import django.core.handlers.wsgi
+application = django.core.handlers.wsgi.WSGIHandler()
+
+if using_newrelic:
+ application = newrelic.agent.wsgi_application()(application)