wsgi.py 1.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
"""
WSGI config for LMS.

This module contains the WSGI application used by Django's development server
and any production WSGI deployments.
It exposes a module-level variable named ``application``. Django's
``runserver`` and ``runfcgi`` commands discover this application via the
``WSGI_APPLICATION`` setting.
"""

11 12 13 14
# Patch the xml libs
from safe_lxml import defuse_xml_libs
defuse_xml_libs()

15 16 17 18
# Disable PyContract contract checking when running as a webserver
import contracts
contracts.disable_all()

19 20
import openedx.core.operations
openedx.core.operations.install_memory_dumper()
21

22
import os
23 24
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.envs.aws")

25 26 27
import lms.startup as startup
startup.run()

28 29 30 31
from xmodule.modulestore.django import modulestore

# Trigger a forced initialization of our modulestores since this can take a
# while to complete and we want this done before HTTP requests are accepted.
32
modulestore()
33 34


35 36 37
# This application object is used by the development server
# as well as any WSGI server configured to use this file.
from django.core.wsgi import get_wsgi_application
38
application = get_wsgi_application()  # pylint: disable=invalid-name