ldt/web/ldtplatform/wsgi.py
author ymh <ymh.work@gmail.com>
Fri, 19 Oct 2012 02:17:46 +0200
changeset 35 a54d72ee2e41
parent 19 821b602056a8
permissions -rwxr-xr-x
change default language + wsgi
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
"""
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
WSGI config for ldtplatform project.
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
This module contains the WSGI application used by Django's development server
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
and any production WSGI deployments. It should expose a module-level variable
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
this application via the ``WSGI_APPLICATION`` setting.
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
Usually you will have the standard Django WSGI application here, but it also
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
might make sense to replace the whole Django WSGI application with a custom one
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
that later delegates to the Django one. For example, you could introduce WSGI
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
middleware here, or combine a Django application with an application of another
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
framework.
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
"""
19
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    16
import sys,os
1
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ldtplatform.settings")
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
35
a54d72ee2e41 change default language + wsgi
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    20
if 'PROJECT_PATH' in os.environ:
a54d72ee2e41 change default language + wsgi
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    21
    sys.path.append(os.environ['PROJECT_PATH'])
19
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    22
for path in os.environ.get('PYTHON_PATH',"").split(os.pathsep):
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    23
    if path:
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    24
        site.addsitedir(path)
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    25
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    26
1
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
# This application object is used by any WSGI server configured to use this
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
# file. This includes Django's development server, if the WSGI_APPLICATION
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
# setting points here.
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
from django.core.wsgi import get_wsgi_application
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
application = get_wsgi_application()
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
# Apply WSGI middleware here.
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
# from helloworld.wsgi import HelloWorldApplication
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
# application = HelloWorldApplication(application)
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
if os.environ.get('PYDEV_DEBUG', "False").lower() in ["true", "1", "t"]:
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
    import pydevd #@UnresolvedImport
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
    pydevd.settrace(suspend=False)