在没有Internet的情况下以脱机模式运行。只显示地图。.

时间:2018-08-01 09:10:45

标签: plotly dashboard plotly-dash

我没有看到页面正在加载任何图,也没有显示任何图形 enter image description here

我的python版本是:Anaconda 3 Python 3.6.4 我的服务器:centos7,无法访问互联网

首先,我安装了所有源代码,并用python setup.py 安装了所有源代码

install dash 0.22.0 
install dash-renderer 0.13.0 
install dash-html-components 0.11.0 
install dash-core-components 0.26.0 
install plotly the latest version

我尝试使用许多浏览器(例如Chrome,Firefox和Internet Explorer)打开页面,但仍显示加载状态。

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.offline as offline
import plotly.graph_objs as go


app = dash.Dash()
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,host = '0.0.0.0',port=5001)

我重试做资产文件夹并放入 custom-script.js header.css typography.css

输入仍不显示任何内容……

inspect element Network Monitor image png without assets folder 我该如何解决这个问题?

link for the issue in dash form i open

3 个答案:

答案 0 :(得分:1)

默认情况下,plot dash使用CDN来提供某些文件。

要离线使用它,必须在代码中指定它。

最小示例:

# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()

# Serve files locally
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True

app.layout = html.Div(
    [ html.H1("This is a test")]
)

if __name__ == '__main__':
    app.run_server(debug=True)

答案 1 :(得分:0)

谢谢,我已经通过卸载dash-renderer 0.13.0来解决它并再次安装它,我意识到,当我打开监视器网络时,对于dash-layout或dash-dependencies来说并没有GET,所以我尝试卸载dash-renderer 0.13 .0并重新安装,现在即可正常工作

the problem solving by png

答案 2 :(得分:0)

谢谢,我已经通过卸载dash-renderer 0.13.0来解决它并再次安装它,我意识到,当我打开监视器网络时,对于dash-layout或dash-dependencies来说并没有GET,所以我尝试卸载dash-renderer 0.13。 .0并重新安装,现在的工作谢谢

相关问题