view mysite/apache/madeira.wsgi @ 32:fb72a1e65121

Add back the fancy box init code to allow fancybox to work on the index page.
author Brian Neal <bgneal@gmail.com>
date Thu, 11 Aug 2011 19:00:32 +0000
parents efb2da0b5d10
children 903260593491
line wrap: on
line source
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/'


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