~devcamcar/horizon/lp711024

« back to all changes in this revision

Viewing changes to dashboard/wsgi/django.wsgi

  • Committer: Devin Carlen
  • Date: 2011-01-12 21:43:31 UTC
  • Revision ID: devin.carlen@gmail.com-20110112214331-7xt353qe2e7vala6
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import logging
 
2
import os
 
3
import sys
 
4
import django.core.handlers.wsgi
 
5
from django.conf import settings
 
6
 
 
7
os.environ['DJANGO_SETTINGS_MODULE'] = 'dashboard.settings'
 
8
sys.stdout = sys.stderr
 
9
 
 
10
DEBUG = False
 
11
 
 
12
class WSGIRequest(django.core.handlers.wsgi.WSGIRequest):
 
13
    def is_secure(self):
 
14
        value = self.META.get('wsgi.url_scheme', '').lower()
 
15
        if value == 'https':
 
16
            return True
 
17
        return False
 
18
 
 
19
class WSGIHandler(django.core.handlers.wsgi.WSGIHandler):
 
20
    request_class = WSGIRequest
 
21
 
 
22
_application = WSGIHandler()
 
23
 
 
24
def application(environ, start_response):
 
25
    environ['PATH_INFO'] = environ['SCRIPT_NAME'] + environ['PATH_INFO']
 
26
    environ['wsgi.url_scheme'] = environ.get('HTTP_X_URL_SCHEME', 'http')
 
27
 
 
28
    return _application(environ, start_response)
 
29