-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwsgi.py
More file actions
38 lines (26 loc) · 1.07 KB
/
wsgi.py
File metadata and controls
38 lines (26 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
WSGI config for deis project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
"""
from __future__ import unicode_literals
import os
from django.core.wsgi import get_wsgi_application
import static
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "deis.settings")
class Dispatcher(object):
"""
Dispatches requests between two WSGI apps, a static file server and a
Django server.
"""
def __init__(self):
self.django_handler = get_wsgi_application()
self.static_handler = static.Cling(os.path.dirname(os.path.dirname(__file__)))
def __call__(self, environ, start_response):
if environ['PATH_INFO'].startswith('/static'):
return self.static_handler(environ, start_response)
else:
return self.django_handler(environ, start_response)
application = Dispatcher()