Mercurial > public > sg101
view sg101/apache/sg101.wsgi @ 1110:38946dfe9cba
Try to expand bandmap canvas.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 10 Jul 2016 21:55:53 -0500 |
parents | 92b4baa0383b |
children |
line wrap: on
line source
import os import sys import site OFFLINE = False site.addsitedir('/svr/django-sites/sg101/lib/python2.7/site-packages') sys.path.append('/svr/django-sites/sg101/sg101') sys.path.append('/svr/django-sites/sg101/sg101/tools') os.environ['PYTHON_EGG_CACHE'] = '/svr/django-sites/sg101/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 = 'SurfGuitar101.com 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'] = 'sg101.settings.production' from django.core.wsgi import get_wsgi_application application = get_wsgi_application() else: application = offline_handler