startup.py 716 Bytes
Newer Older
1 2 3
"""
Module for code that should run during LMS startup
"""
Calen Pennington committed
4 5
import logging

6 7 8 9 10 11
from django.conf import settings

# Force settings to run so that the python path is modified
settings.INSTALLED_APPS  # pylint: disable=W0104

from django_startup import autostartup
12
from xmodule.modulestore.django import modulestore
13

Calen Pennington committed
14
log = logging.getLogger(__name__)
15 16 17 18 19 20

def run():
    """
    Executed during django startup
    """
    autostartup()
21

22 23 24 25 26
    # 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.
    if settings.INIT_MODULESTORE_ON_STARTUP:
        for store_name in settings.MODULESTORE:
            modulestore(store_name)