@@ -38,7 +38,7 @@ def append_script(self, script):
3838 self .items .append (script )
3939
4040class 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
143145class 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