ldt/web/ldtplatform/wsgi.py
author ymh <ymh.work@gmail.com>
Thu, 11 Oct 2012 10:27:45 +0200
changeset 19 821b602056a8
parent 1 08f6e99af174
child 35 a54d72ee2e41
permissions -rwxr-xr-x
prepare hyperplateau for translation
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
19
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    20
sys.path.append(os.environ['PROJECT_PATH'])
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    21
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
    22
    if path:
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    23
        site.addsitedir(path)
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    24
821b602056a8 prepare hyperplateau for translation
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    25
1
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
# 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
    27
# 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
    28
# setting points here.
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
from django.core.wsgi import get_wsgi_application
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
application = get_wsgi_application()
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
# Apply WSGI middleware here.
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
# from helloworld.wsgi import HelloWorldApplication
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
# application = HelloWorldApplication(application)
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
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
    37
    import pydevd #@UnresolvedImport
08f6e99af174 prepare the installation of the ldt platform
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
    pydevd.settrace(suspend=False)