web/ldtplatform/modwsgi.wsgi
author ymh <ymh.work@gmail.com>
Sat, 15 Oct 2011 23:41:36 +0200
changeset 6 6befc470b1e6
parent 4 238f3cd543f2
permissions -rwxr-xr-x
correct path to make it work, back to normal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
     1
import os, sys, site
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
     2
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
     3
def application(environ, start_response):
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
     4
    
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
     5
    global g_env_set
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
     6
    
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
     7
    if 'g_env_set' not in globals() or not g_env_set:
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
     8
        os.environ['DJANGO_SETTINGS_MODULE'] = environ['DJANGO_SETTINGS_MODULE']
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
     9
    
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    10
        prev_sys_path = list(sys.path)
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    11
    
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    12
        sys.path.append(environ['PROJECT_PATH'])
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    13
        for path in environ.get('PYTHON_PATH',"").split(os.pathsep):
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    14
            if path:
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    15
                site.addsitedir(path)
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    16
    
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    17
        new_sys_path = [] 
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    18
        for item in list(sys.path): 
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    19
            if item not in prev_sys_path and item not in new_sys_path: 
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    20
                new_sys_path.append(item) 
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    21
                sys.path.remove(item)
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    22
        sys.path[:0] = new_sys_path
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    23
        g_env_set = True 
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    24
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    25
    import django.core.handlers.wsgi
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    26
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    27
    _application = django.core.handlers.wsgi.WSGIHandler()
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    28
    
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    29
    if environ.get('PYDEV_DEBUG', "False").lower() in ["true", "1", "t"]:
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    30
        import pydevd #@UnresolvedImport
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    31
        pydevd.settrace(suspend=False)
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    32
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    33
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    34
    return _application(environ, start_response)
40d6b5e3dcd7 First Regards Signés Commit. Caution : ldt is not installed in the virtualenv, we have to copy the ldt folder to the site-packages. Otherwise, it works perfectly.
tc
parents:
diff changeset
    35