Commit b30a94b8 by John Eskew

Move django.setup() as the first step in the run() call in order to

setup all the applications before monkey-patching, which needs to
import models.
parent c9b472d2
...@@ -9,11 +9,6 @@ settings.INSTALLED_APPS # pylint: disable=pointless-statement ...@@ -9,11 +9,6 @@ settings.INSTALLED_APPS # pylint: disable=pointless-statement
from openedx.core.lib.django_startup import autostartup from openedx.core.lib.django_startup import autostartup
import django import django
from monkey_patch import (
third_party_auth,
django_db_models_options
)
from openedx.core.lib.xblock_utils import xblock_local_resource_url
import xmodule.x_module import xmodule.x_module
import cms.lib.xblock.runtime import cms.lib.xblock.runtime
...@@ -25,6 +20,12 @@ def run(): ...@@ -25,6 +20,12 @@ def run():
""" """
Executed during django startup Executed during django startup
""" """
django.setup()
from monkey_patch import (
third_party_auth,
django_db_models_options
)
third_party_auth.patch() third_party_auth.patch()
django_db_models_options.patch() django_db_models_options.patch()
...@@ -33,8 +34,6 @@ def run(): ...@@ -33,8 +34,6 @@ def run():
if settings.COMPREHENSIVE_THEME_DIR: if settings.COMPREHENSIVE_THEME_DIR:
enable_comprehensive_theme(settings.COMPREHENSIVE_THEME_DIR) enable_comprehensive_theme(settings.COMPREHENSIVE_THEME_DIR)
django.setup()
autostartup() autostartup()
add_mimetypes() add_mimetypes()
...@@ -46,6 +45,7 @@ def run(): ...@@ -46,6 +45,7 @@ def run():
# monkey-patch the x_module library. # monkey-patch the x_module library.
# TODO: Remove this code when Runtimes are no longer created by modulestores # TODO: Remove this code when Runtimes are no longer created by modulestores
# https://openedx.atlassian.net/wiki/display/PLAT/Convert+from+Storage-centric+runtimes+to+Application-centric+runtimes # https://openedx.atlassian.net/wiki/display/PLAT/Convert+from+Storage-centric+runtimes+to+Application-centric+runtimes
from openedx.core.lib.xblock_utils import xblock_local_resource_url
xmodule.x_module.descriptor_global_handler_url = cms.lib.xblock.runtime.handler_url xmodule.x_module.descriptor_global_handler_url = cms.lib.xblock.runtime.handler_url
xmodule.x_module.descriptor_global_local_resource_url = xblock_local_resource_url xmodule.x_module.descriptor_global_local_resource_url = xblock_local_resource_url
......
...@@ -12,10 +12,6 @@ from openedx.core.lib.django_startup import autostartup ...@@ -12,10 +12,6 @@ from openedx.core.lib.django_startup import autostartup
import edxmako import edxmako
import logging import logging
import analytics import analytics
from monkey_patch import (
third_party_auth,
django_db_models_options
)
import xmodule.x_module import xmodule.x_module
import lms_xblock.runtime import lms_xblock.runtime
...@@ -30,6 +26,12 @@ def run(): ...@@ -30,6 +26,12 @@ def run():
""" """
Executed during django startup Executed during django startup
""" """
django.setup()
from monkey_patch import (
third_party_auth,
django_db_models_options
)
third_party_auth.patch() third_party_auth.patch()
django_db_models_options.patch() django_db_models_options.patch()
...@@ -47,8 +49,6 @@ def run(): ...@@ -47,8 +49,6 @@ def run():
# before the django.setup(). # before the django.setup().
microsite.enable_microsites_pre_startup(log) microsite.enable_microsites_pre_startup(log)
django.setup()
autostartup() autostartup()
add_mimetypes() add_mimetypes()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment