| author | ymh <ymh.work@gmail.com> |
| Fri, 06 May 2011 01:01:51 +0200 | |
| changeset 95 | 8e57d39f660d |
| parent 63 | 93325a5d61f0 |
| child 111 | 4535dafa6007 |
| permissions | -rw-r--r-- |
| 63 | 1 |
import os |
2 |
import sys |
|
3 |
import site |
|
| 0 | 4 |
|
5 |
def application(environ, start_response): |
|
6 |
os.environ['DJANGO_SETTINGS_MODULE'] = environ['DJANGO_SETTINGS_MODULE'] |
|
7 |
||
8 |
prev_sys_path = list(sys.path) |
|
9 |
||
10 |
sys.path.append(environ['PROJECT_PATH']) |
|
|
13
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
11 |
for path in environ.get('PYTHON_PATH', "").split(os.pathsep): |
|
1
6a2a816d4ba3
correct virtual env res + htaccess + mod wsgi
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
12 |
if path: |
|
6a2a816d4ba3
correct virtual env res + htaccess + mod wsgi
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
13 |
site.addsitedir(path) |
| 0 | 14 |
|
15 |
new_sys_path = [] |
|
16 |
for item in list(sys.path): |
|
17 |
if item not in prev_sys_path: |
|
18 |
new_sys_path.append(item) |
|
|
1
6a2a816d4ba3
correct virtual env res + htaccess + mod wsgi
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
19 |
sys.path.remove(item) |
| 0 | 20 |
sys.path[:0] = new_sys_path |
21 |
||
22 |
import django.core.handlers.wsgi |
|
23 |
||
24 |
_application = django.core.handlers.wsgi.WSGIHandler() |
|
25 |
||
|
13
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
26 |
return _application(environ, start_response) |