Пример #1
0
 def load_apps(self, apps):
     app_list = []
     for app_entry in apps:
         try:
             app_mod = import_module(app_entry)
         except ImportError, e:
             raise CommandError('ImportError %s: %s' % (app_entry, e.args[0]))
         app_media_dir = os.path.join(
             os.path.dirname(app_mod.__file__), 'media')
         if os.path.isdir(app_media_dir):
             app_list.append(app_mod)
Пример #2
0
 def load_apps(self, apps):
     app_list = []
     for app_entry in apps:
         try:
             app_mod = import_module(app_entry)
         except ImportError, e:
             raise CommandError('ImportError %s: %s' %
                                (app_entry, e.args[0]))
         app_media_dir = os.path.join(os.path.dirname(app_mod.__file__),
                                      'media')
         if os.path.isdir(app_media_dir):
             app_list.append(app_mod)
Пример #3
0
            print "\n    DRY RUN! NO FILES WILL BE MODIFIED."
        print "\nCollecting media in %s" % media_root

        if app_labels:
            try:
                app_list = [models.get_app(label) for label in app_labels]
            except (ImproperlyConfigured, ImportError), e:
                raise CommandError("%s. Is your INSTALLED_APPS setting correct?" % e)
        else:
            if not options.get("all", False):
                raise CommandError("Enter at least one appname or use the --all option")

            app_list = []
            for app_entry in settings.INSTALLED_APPS:
                try:
                    app_mod = import_module(app_entry)
                except ImportError, e:
                    raise CommandError("ImportError %s: %s" % (app, e.args[0]))
                app_media_dir = os.path.join(os.path.dirname(app_mod.__file__), "media")
                if os.path.isdir(app_media_dir):
                    app_list.append(app_mod)

        app_labels = [app.__name__.rsplit(".", 1)[-1] for app in app_list]
        print "Traversing apps: %s" % get_text_list(app_labels, "and")
        for app_mod in app_list:
            self.handle_app(app_mod, **options)

        # Look in additional locations for media
        extra_media = []
        for label, path in EXTRA_MEDIA:
            if os.path.isdir(path):