Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions demo/demo/bootstrap_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
SOFTWARE.
'''

import dash
import dash_bootstrap_components as dbc
import dash_html_components as html

Expand All @@ -33,8 +32,7 @@

dd.layout = html.Div(
[
dbc.Alert("This is an alert", color="primary"),
dbc.Alert("Danger", color="danger"),
]
dbc.Alert("This is an alert", color="primary"),
dbc.Alert("Danger", color="danger"),
]
)

3 changes: 2 additions & 1 deletion django_plotly_dash/dash_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ class DjangoDash:

To use, construct an instance of DjangoDash() in place of a Dash() one.
'''
#pylint: disable=too-many-instance-attributes
def __init__(self, name=None, serve_locally=False,
expanded_callbacks=False,
add_bootstrap_links=False,
suppress_callback_exceptions=False,
**kwargs): # pylint: disable=unused-argument
**kwargs): # pylint: disable=unused-argument, too-many-arguments
if name is None:
global uid_counter # pylint: disable=global-statement
uid_counter += 1
Expand Down
13 changes: 10 additions & 3 deletions django_plotly_dash/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
from django.core.files.storage import FileSystemStorage

from django.conf import settings
from django.apps import apps
from django.apps import apps #pylint: disable=unused-import

from django_plotly_dash.dash_wrapper import all_apps

class DashComponentFinder(BaseFinder):
'Find static files in components'

#pylint: disable=abstract-method, redefined-builtin

def __init__(self):

self.locations = []
Expand Down Expand Up @@ -87,20 +89,24 @@ def find(self, path, all=False):

return matches

# pylint: disable=inconsistent-return-statements, no-self-use
def find_location(self, path):
'Return location, if it exists'
if os.path.exists(path):
return path

def list(self, ignore_patterns):
for component_name in self.locations:
storage = self.storages[component_name]
for path in get_files(storage, ignore_patterns + self.ignore_patterns):
print("DashAssetFinder",path,storage)
print("DashAssetFinder", path, storage)
yield path, storage

class DashAssetFinder(BaseFinder):
'Find static files in asset directories'

#pylint: disable=unused-import, unused-variable, no-name-in-module, import-error, abstract-method

def __init__(self):

# Get all registered apps
Expand All @@ -120,7 +126,7 @@ def __init__(self):
for app_slug, obj in self.apps.items():
caller_module = obj.caller_module
location = obj.caller_module_location
path_directory = os.path.join(os.path.dirname(location),self.subdir)
path_directory = os.path.join(os.path.dirname(location), self.subdir)

if os.path.isdir(path_directory):

Expand All @@ -134,6 +140,7 @@ def __init__(self):

super(DashAssetFinder, self).__init__()

#pylint: disable=redefined-builtin
def find(self, path, all=False):
return []

Expand Down
2 changes: 1 addition & 1 deletion django_plotly_dash/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
This addresses issue #81
'''

__version__ = "0.9.5"
__version__ = "0.9.6"
3 changes: 2 additions & 1 deletion django_plotly_dash/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def main_view(request, ident, stateless=False, cache_id=None, **kwargs):
return HttpResponse(resp)

def component_component_suites(request, resource=None, component=None, **kwargs):
'Return part of a client-side component, served locally for some reason'
return component_suites(request,
resource=resource,
component=component,
Expand All @@ -116,7 +117,7 @@ def component_suites(request, resource=None, component=None, extra_element="", *
else:
redone_url = "/static/dash/component/%s/%s%s" %(component, extra_element, resource)

print("Redirecting to :",redone_url)
print("Redirecting to :", redone_url)

return HttpResponseRedirect(redirect_to=redone_url)

Expand Down