def get_dir_list(pwd, ROOT_DIR=THEME_ROOT, include_plugins=False): """ Get a list of directories from within the theme folder based on the present working directory if the pwd is the None this will include a list of plugins in the dir_list. """ dir_list = [] if pwd.startswith("plugins.") and include_plugins: plugin_name = pwd.split('plugins.')[1].split('/')[0] current_dir = os.path.join(settings.PROJECT_ROOT, "plugins", plugin_name, 'templates', pwd.split('plugins.')[1]) else: current_dir = os.path.join(ROOT_DIR, pwd) if include_plugins and not pwd: import pluginmanager plugins = pluginmanager.plugin_apps(()) for plugin in plugins: dir_list.append(plugin) if os.path.isdir(current_dir): item_list = os.listdir(current_dir) for item in item_list: current_item = os.path.join(current_dir, item) if os.path.isdir(current_item): dir_list.append(os.path.join(pwd,item)) return sorted(dir_list)
def _update_apps(instance=None, created=False): db2json() from django.conf import settings from django.db.models.loading import cache as app_cache from pluginmanager import plugin_apps settings.INSTALLED_APPS = plugin_apps(settings.DEFAULT_INSTALLED_APPS) app_cache.loaded = False # clear cache call_command('syncdb', interactive=False, migrate_all=True) call_command('touch_settings') # update the site settings (in database) if any if instance: call_command('update_settings', smart_str(instance.package))
# ------------------------------------ # # PHOTOLOGUE SETTINGS # ------------------------------------ # PHOTOLOGUE_MAXBLOCK = 2**20 # prevents 'IOError: encoder error -2' #-------------------------------------------------------# # A note for non real time indexes update status # displaying on the search templates where there non_realtime # indexes are being used. #-------------------------------------------------------# INDEX_UPDATE_NOTE = 'updated hourly' # local settings for development try: from local_settings import * except ImportError: pass # ------------------------------------ # # PLUGINS # ------------------------------------ # # THIS MUST BE AT THE END! import pluginmanager DEFAULT_INSTALLED_APPS = INSTALLED_APPS INSTALLED_APPS = pluginmanager.plugin_apps(INSTALLED_APPS) PLUGINS_PATH = os.path.join(PROJECT_ROOT, 'plugins') sys.path.insert(0, PLUGINS_PATH)