src/jocondelab/wsgi.py
author ymh <ymh.work@gmail.com>
Fri, 28 Jun 2013 18:16:58 +0200
changeset 54 040d7a2adb27
parent 13 54775fd2381f
child 334 169b7cfd1f58
permissions -rw-r--r--
Added tag V00.08 for changeset c7c02a4d2a54
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
"""
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
WSGI config for jocondelab project.
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
This module contains the WSGI application used by Django's development server
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
and any production WSGI deployments. It should expose a module-level variable
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
this application via the ``WSGI_APPLICATION`` setting.
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
Usually you will have the standard Django WSGI application here, but it also
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
might make sense to replace the whole Django WSGI application with a custom one
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
that later delegates to the Django one. For example, you could introduce WSGI
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
middleware here, or combine a Django application with an application of another
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
framework.
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
"""
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
import os
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
# if running multiple sites in the same mod_wsgi process. To fix this, use
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
# mod_wsgi daemon mode with each site in its own daemon process, or use
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
# os.environ["DJANGO_SETTINGS_MODULE"] = "jocondelab.settings"
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "jocondelab.settings")
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
# This application object is used by any WSGI server configured to use this
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
# file. This includes Django's development server, if the WSGI_APPLICATION
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
# setting points here.
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
from django.core.wsgi import get_wsgi_application
13
54775fd2381f correct wsgi.py
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    28
application = get_wsgi_application()
10
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
# Apply WSGI middleware here.
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
# from helloworld.wsgi import HelloWorldApplication
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
# application = HelloWorldApplication(application)
2a820542808c restore wsgi app
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33