Comments (19)
Did you try the suggestion at the bottom of the user guide?
https://plot.ly/dash/external-resources
from dash import Dash
app = Dash()
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
from dash.
Did you try the suggestion at the bottom of the user guide?
from dash import Dash
app = Dash()
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
That's it exactly. The dcc.Graph
objects should be rendered offline too.
Here is a standalone example that works for me with my wifi turned off:
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash('offline example')
app.layout = html.Div([
dcc.Graph(id='my-graph', figure={'data': [{'x': [1, 2, 3], 'y': [4, 1, 2]}]})
])
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
if __name__ == '__main__':
app.run_server(debug=True)
@sbowman-mitre - Could you try this example and see if it works?
from dash.
Thanks @sbowman-mitre ! I'll close this issue but I've opened a secondary one for this more specific problem with serving files on windows: #56
from dash.
Oh that won't help then, as they are generating the figure directly in dash. The offline library I referenced only helps when the graph is being generated in a callback. Disregard my suggestion.
from dash.
Thanks for reporting @sbowman-mitre ! I've actually seen this before. In this case, the flask server is having trouble serving the large javascript bundle (1MB or larger) from the file system. I've only seen this happen on Windows machines and servers.
I'm not yet sure how to resolve this or make this more stable.
from dash.
Thanks for opening this, @marugari . This offline behavior is what I was wondering about too. When I try the recommended fix, I am unable to render dcc.Graph() objects. Is this expected behavior when running offline?
from dash.
Graph() objects should be rendered offline. Can you post the errors you are having?
from dash.
I don't get an error in the browser or the console running dash. I just don't get a page load. At the browser level, the HTML just renders "Loading..." and never gets passed that (waited for quite a while).
from dash.
I'm going from memory as I am not running dash offline now, but are you importing plot from plotly.offline?
for example:
from plotly.offline import download_plotlyjs, plot
otherwise it'll still try and get the plotlyjs file from the CDN.
from dash.
No, I'm not. I'm just running the first tutorial (here) which does not import anything specifically from plotly. I will try your import statement and report back.
from dash.
Yes, your example does render for me. That's good news!
Yes, I had added those lines to my script and it did not render. Here's the entirety of my script:
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
# Force offline usage (also fails to render graph, issue #46)
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
from dash.
My thanks to @pl77 and @chriddyp.
I think "Rendering dash apps offline"(https://plot.ly/dash/external-resources) should be independent.
from dash.
Great, thanks! @sbowman-mitre - that script that you posted actually works for me OK:
from dash.
Okay, good to know. That means it's something on my end. Maybe my browser (which is up-to-date Chrome)? But, good to know the general concept should be working.
from dash.
Hm.. I'm not sure what it could be. I have down some browser testing on these apps. If open up the Chrome Dev Tools, are there any red errors printed out?
from dash.
@chriddyp : curiously, the script loads under some conditions today. Not sure what that means; I haven't rebooted in the meantime. 🤷♂️ When it doesn't load, here's the devtools view:
from dash.
Well, doesn't sound like there's much you can do except raise it up to the flask group. You can close this issue (from my perspective, anyway).
from dash.
This was outstanding help. Thank you.
from dash.
just a kind reminder, firefox addons such as "Decentraleyes" which block cdn tracking may a reason why your page not loading properly.
from dash.
Related Issues (20)
- Background callbacks with celery + redis getting 204s HOT 1
- How does the new version of dash dynamically create callback HOT 1
- When there are three identical outputs, the allow_duplicate is set and an error will be reported. HOT 5
- dash title design issues HOT 3
- [BUG] When using multiple instances of dash on a flask server, they cannot share the same page name, even though they have different url routes HOT 3
- How does dash combine with flask jwt? HOT 1
- The problem of parameter transparency between dash custom components HOT 1
- Running argument in a callback breaks when provided with a dictionary as an component_id instead of a string HOT 2
- [BUG] Dash Testing: `wait_for_text_to_equal` may incorrectly succeed when used with text `"None"` HOT 1
- [Feature Request] Allow dcc.Dropdown with multi=True to stay open when item is selected HOT 3
- Can callback be set to take effect with the current page or globally HOT 1
- [BUG] Using gunicorn to deploy a dash app with plotly-resampler in Linux, and the figure didnt render correctly
- [BUG] cannot pickle 'SSLContext' with background callback HOT 5
- [BUG] A progress callable of a bg callback sometimes doesn't trigger. HOT 2
- [BUG] dcc.Clipboard functionality broken in Notification component HOT 6
- [Feature Request] Ability to specify order of components when using pattern-matching wildcards (ALL) HOT 1
- [Feature Request] Exporting the dev tool callback graph in a standardized graph format
- [BUG] Use of `dash_duo` hangs Github Action until Timeout HOT 1
- [BUG] dbc.Modal(style) is passed to fade-modal-show layer instead modal HOT 1
- [BUG] Persistence failed in component type props
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dash.