Mercurial > public > madeira
view madeira/apache/madeira.wsgi @ 87:978a08c838d8
Updates for moving to new jaguar server.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 13 Apr 2013 16:04:09 -0500 |
parents | e2868ad47a1e |
children | 491f0acbaeaf |
line wrap: on
line source
import os import sys import site OFFLINE = False site.addsitedir('/svr/django-sites/madeira/lib/python2.7/site-packages') sys.path.append('/svr/django-sites/madeira/madeira') os.environ['PYTHON_EGG_CACHE'] = '/svr/django-sites/madeira/eggs/' 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'] = 'madeira.settings.production' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() else: application = offline_handler