diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-06-25 14:28:36 +0100 |
---|---|---|
committer | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-07-04 13:41:31 +0100 |
commit | 05b246095d161143ca2ebc126d9e70d198ab8bb8 (patch) | |
tree | 28fd1a0c46d71e2bbce6fcd13f9d1a73a2d60b5c /lib | |
parent | 4000d8224206f404d174a5bc4aa49af55cb44d27 (diff) | |
download | bitbake-contrib-05b246095d161143ca2ebc126d9e70d198ab8bb8.tar.gz |
toaster: automatically enable applications
We automatically enable local applications in INSTALLED_APPS
based on detecting a models.py or views.py file.
This allows Toaster extensibility by adding applications,
without having to edit configuration files.
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/toaster/toastermain/settings.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py index 2ce10c474..97f2ff7ca 100644 --- a/lib/toaster/toastermain/settings.py +++ b/lib/toaster/toastermain/settings.py @@ -243,6 +243,15 @@ INSTALLED_APPS = ( 'bldcontrol', ) +# We automatically detect and install applications here if +# they have a 'models.py' or 'views.py' file +import os +currentdir = os.path.dirname(__file__) +for t in os.walk(os.path.dirname(currentdir)): + modulename = os.path.basename(t[0]) + if ("views.py" in t[2] or "models.py" in t[2]) and not modulename in INSTALLED_APPS: + INSTALLED_APPS.append(modulename) + # A sample logging configuration. The only tangible logging # performed by this configuration is to send an email to # the site admins on every HTTP 500 error when DEBUG=False. |