Skip to content

Commit

Permalink
Fix dash.staticfiles.finders.DashComponentSuitesFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
pikhovkin committed Dec 6, 2018
1 parent 72db61e commit 5d27478
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions dash/staticfiles/finders.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
from __future__ import print_function

import os
import pkgutil
import sys
from collections import OrderedDict
from importlib import import_module

from django.contrib.staticfiles import utils
from django.core.files.storage import FileSystemStorage
from django.contrib.staticfiles.finders import FileSystemFinder
from django.apps import apps

from ..development.base_component import ComponentRegistry


def _import_module(pkg, m):
try:
_pkg = import_module('.' + m, package=pkg)
except ImportError:
return

views_path = os.path.dirname(_pkg.__file__)
for info in pkgutil.iter_modules([views_path]):
_import_module(pkg + '.' + m, info[1])


class DashComponentSuitesFinder(FileSystemFinder):
prefix = '_dash-component-suites/'
ignore_patterns = ['*.py', '*.pyc', '*.json']

def __init__(self, *args, **kwargs): # pylint: disable=super-init-not-called
# Import all modules that Dash components were registered in ComponentRegistry
for app in apps.app_configs.keys():
_import_module(app, 'views')

if 'dash_renderer' in sys.modules:
# Add dash_renderer manually because it is not a component
ComponentRegistry.registry.add('dash_renderer')

self.locations = []
self.storages = OrderedDict()

Expand Down
2 changes: 1 addition & 1 deletion dash/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.8.1'
__version__ = '0.8.2'

0 comments on commit 5d27478

Please sign in to comment.