Files
edx-platform/openedx/core/lib/django_startup.py
Ned Batchelder a84735057d Move common/lib/*.py to openedx/core/lib
This makes these files importable, and puts them into the new best guess
as to where files should live.
2015-03-23 12:40:24 -04:00

23 lines
542 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()