changeset 47:6dfcbbf11243

Added a .wsgi file and an offline.html file.
author Brian Neal <bgneal@gmail.com>
date Sun, 21 Jun 2009 21:26:49 +0000
parents 0140ff687d49
children 31cb8d55e3a1
files gpp/apache/sg101.wsgi gpp/templates/offline.html
diffstat 2 files changed, 55 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gpp/apache/sg101.wsgi	Sun Jun 21 21:26:49 2009 +0000
@@ -0,0 +1,40 @@
+import os
+import sys
+
+OFFLINE = True
+
+sys.path.append('/home/var/django-sites/sg101/django')
+sys.path.append('/home/var/django-sites/sg101/3rdparty')
+sys.path.append('/home/var/django-sites/sg101/sg101-trunk')
+sys.path.append('/home/var/django-sites/sg101/sg101-trunk/gpp')
+
+os.environ['PYTHON_EGG_CACHE'] = '/home/var/django-sites/sg101/eggs/'
+
+
+def offline_handler(environ, start_response):
+    wsgi_dir = os.path.dirname(__file__)
+    sys.path.append(project_dir)
+
+    offline_file = os.path.join(wsgi_dir, '..', 'templates', 'offline.html')
+    if os.path.exists(offline_file):
+        response_headers = [('Content-type','text/html')]
+        response = open(offline_file).read()
+    else:
+        response_headers = [('Content-type','text/plain')]
+        response = 'SG101 website maintenance in progress; please check back soon.'
+ 
+    if environ['REQUEST_METHOD'] == 'GET':
+        status = '503 Service Unavailable'
+    else:
+        status = '405 Method Not Allowed'
+    start_response(status, response_headers)
+    return [response]
+
+
+if not OFFLINE:
+   os.environ['DJANGO_SETTINGS_MODULE'] = 'gpp.settings'
+   import django.core.handlers.wsgi
+   application = django.core.handlers.wsgi.WSGIHandler()
+else:
+   application = offline_handler
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gpp/templates/offline.html	Sun Jun 21 21:26:49 2009 +0000
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head><title>SurfGuitar101.com Currently Offline</title>
+<meta http-equiv="Content-Type" content="text/html" />
+<meta http-equiv="Content-Language" content="en-US" />
+</head>
+<body>
+   <h1>SurfGuitar101.com is Offline</h1>
+   <p>
+   We are currently undergoing site maintenance and hope to be back soon. Please check back later.
+   </p>
+</body>
+</html>