Skip to content

Commit dff8b3e

Browse files
author
Mark Gibbs
committed
Make serving local content be controlled by a flag. Bump version for release
1 parent b1134f2 commit dff8b3e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

django_plotly_dash/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22

3-
__version__ = "0.4.1"
3+
__version__ = "0.4.2"
44

55
from .dash_wrapper import DjangoDash
66

django_plotly_dash/dash_wrapper.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def append_script(self, script):
3838
self.items.append(script)
3939

4040
class DjangoDash:
41-
def __init__(self, name=None, **kwargs):
41+
def __init__(self, name=None, serve_locally=False, expanded_callbacks=False, **kwargs):
4242
if name is None:
4343
global uid_counter
4444
uid_counter += 1
@@ -54,7 +54,8 @@ def __init__(self, name=None, **kwargs):
5454
add_usable_app(self._uid,
5555
self)
5656

57-
self._expanded_callbacks = False
57+
self._expanded_callbacks = expanded_callbacks
58+
self._serve_locally = serve_locally
5859

5960
def as_dash_instance(self):
6061
'''
@@ -96,7 +97,8 @@ def form_dash_instance(self, replacements=None, ndid=None, base_pathname=None):
9697
rd = WrappedDash(base_pathname=base_pathname,
9798
expanded_callbacks = self._expanded_callbacks,
9899
replacements = replacements,
99-
ndid = ndid)
100+
ndid = ndid,
101+
serve_locally = self._serve_locally)
100102

101103
rd.layout = self.layout
102104

@@ -141,7 +143,7 @@ def run(self,*args,**kwargs):
141143
pass
142144

143145
class WrappedDash(Dash):
144-
def __init__(self, base_pathname=None, replacements = None, ndid=None, expanded_callbacks=False, **kwargs):
146+
def __init__(self, base_pathname=None, replacements = None, ndid=None, expanded_callbacks=False, serve_locally=False, **kwargs):
145147

146148
self._uid = ndid
147149

@@ -154,10 +156,8 @@ def __init__(self, base_pathname=None, replacements = None, ndid=None, expanded_
154156

155157
super(WrappedDash, self).__init__(**kwargs)
156158

157-
self.css.config.serve_locally = True
158-
#self.css.config.serve_locally = False
159-
160-
self.scripts.config.serve_locally = self.css.config.serve_locally
159+
self.css.config.serve_locally = serve_locally
160+
self.scripts.config.serve_locally = serve_locally
161161

162162
self._adjust_id = False
163163
self._dash_dispatch = not expanded_callbacks

0 commit comments

Comments
 (0)