forked from kayaelle/badgr-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wsgi.py
27 lines (19 loc) · 835 Bytes
/
wsgi.py
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
import os
import sys
# assume we(this file) have a parent that is a sibling to the CODE_DIR
OUR_DIR = os.path.abspath(os.path.dirname(__file__))
# code dir is one level above us
APPS_DIR = os.path.join(OUR_DIR, '..', 'code', 'apps')
# the env dir is one level above us
ENV_DIR = os.path.join(OUR_DIR, '..', 'env')
# activate the virtualenv
activate_this = os.path.join(ENV_DIR, 'bin', 'activate_this.py')
exec(compile(open(activate_this, "rb").read(), activate_this, 'exec'), dict(__file__=activate_this))
# add the apps directory to the python path
sys.path.insert(0, APPS_DIR)
# load up django
from django.core.wsgi import get_wsgi_application
# tell django to find settings entry point'
os.environ['DJANGO_SETTINGS_MODULE'] = 'mainsite.settings_local'
# hand off to the wsgi application
application = get_wsgi_application()