Files
edx-platform/common/lib/django_startup.py
Ned Batchelder 39380f2d22 Very Minor tweaks to the LMS and CMS startup.
I was going to do something in the startup code, then changed my mind,
but didn't want to just discard these changes.
2014-01-02 14:27:52 -05:00

22 lines
541 B
Python

"""
Automatic execution of startup modules in Django apps.
"""
from importlib import import_module
from django.conf import settings
def autostartup():
"""
Execute app.startup:run() for all installed django apps
"""
for app in settings.INSTALLED_APPS:
# See if there's a startup module in each app.
try:
mod = import_module(app + '.startup')
except ImportError:
continue
# If the module has a run method, run it.
if hasattr(mod, 'run'):
mod.run()