# HG changeset patch # User Brian Neal # Date 1301443258 0 # Node ID 186c30a29be4d25641bf3773018bdf59363f2f56 # Parent ead7bd49c9e009da4ad0e23f5f5432bf92c97873 Updating the madeira.wsgi file; added a robots.txt. diff -r ead7bd49c9e0 -r 186c30a29be4 mysite/apache/madeira.wsgi --- a/mysite/apache/madeira.wsgi Tue Mar 29 01:51:10 2011 +0000 +++ b/mysite/apache/madeira.wsgi Wed Mar 30 00:00:58 2011 +0000 @@ -1,11 +1,37 @@ import os import sys +OFFLINE = False + sys.path.append('/home/var/django-sites/madeira/django-trunk') sys.path.append('/home/var/django-sites/madeira/madeira-trunk') +sys.path.append('/home/var/django-sites/madeira/madeira-trunk/mysite') os.environ['PYTHON_EGG_CACHE'] = '/home/var/django-sites/madeira/eggs/' -os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' -import django.core.handlers.wsgi -application = django.core.handlers.wsgi.WSGIHandler() +def offline_handler(environ, start_response): + wsgi_dir = os.path.dirname(__file__) + sys.path.append(wsgi_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 = 'themadeira.net 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'] = 'mysite.settings' + import django.core.handlers.wsgi + application = django.core.handlers.wsgi.WSGIHandler() +else: + application = offline_handler diff -r ead7bd49c9e0 -r 186c30a29be4 static/robots.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/static/robots.txt Wed Mar 30 00:00:58 2011 +0000 @@ -0,0 +1,2 @@ +User-agent: * +Crawl-delay: 30