diff options
| author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-06-25 14:28:36 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-14 14:10:02 +0100 |
| commit | c35b678053a3fea3a928bdb11a28d1e3cee329e2 (patch) | |
| tree | 66e285ee8d9701a969ce6813b4f93f59b7db1954 | |
| parent | 5790b60d00c6a564b80d7ef033d84685dd3ef3d4 (diff) | |
| download | poky-c35b678053a3fea3a928bdb11a28d1e3cee329e2.tar.gz | |
bitbake: 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.
(Bitbake rev: 05b246095d161143ca2ebc126d9e70d198ab8bb8)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 2ce10c4747..97f2ff7cab 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
| @@ -243,6 +243,15 @@ INSTALLED_APPS = ( | |||
| 243 | 'bldcontrol', | 243 | 'bldcontrol', |
| 244 | ) | 244 | ) |
| 245 | 245 | ||
| 246 | # We automatically detect and install applications here if | ||
| 247 | # they have a 'models.py' or 'views.py' file | ||
| 248 | import os | ||
| 249 | currentdir = os.path.dirname(__file__) | ||
| 250 | for t in os.walk(os.path.dirname(currentdir)): | ||
| 251 | modulename = os.path.basename(t[0]) | ||
| 252 | if ("views.py" in t[2] or "models.py" in t[2]) and not modulename in INSTALLED_APPS: | ||
| 253 | INSTALLED_APPS.append(modulename) | ||
| 254 | |||
| 246 | # A sample logging configuration. The only tangible logging | 255 | # A sample logging configuration. The only tangible logging |
| 247 | # performed by this configuration is to send an email to | 256 | # performed by this configuration is to send an email to |
| 248 | # the site admins on every HTTP 500 error when DEBUG=False. | 257 | # the site admins on every HTTP 500 error when DEBUG=False. |
