Forks

Revisions

gist: 186787 Download_button fork
public
Description:
Django app auto-import
Public Clone URL: git://gist.github.com/186787.git
Embed All Files: show embed
Django app auto-import #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import importlib, os
APP_DIRS = (os.path.abspath(os.path.join(PROJECT_ROOT, 'test')),)
sys.path.extend(APP_DIRS)
BASE_URL_CONFS = []
for app_dir in APP_DIRS:
    for app in os.listdir(app_dir):
        if not app.startswith('.') and app not in INSTALLED_APPS:
            try:
                app_settings = importlib.import_module('%s.settings' % app)
                if getattr(app_settings, 'APP_NAME', '') != '':
                    print "Auto Installed %s" % app
                    INSTALLED_APPS = INSTALLED_APPS + (app,)
                base_url_conf = getattr(app_settings, 'BASE_URL_CONF', '')
                if base_url_conf != '':
                    BASE_URL_CONFS.append(base_url_conf)
            except ImportError:
                pass