我正在测试一个简单的破折号应用程序,该应用程序已从一个入门示例中进行了修改。我可以从运行应用程序的计算机访问仪表板,但无法在其他任何地方访问它。这是程序。
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import flask
df = pd.read_csv(
'https://gist.githubusercontent.com/chriddyp/'
'c78bf172206ce24f77d6363a2d754b59/raw/'
'c353e8ef842413cae56ae3920b8fd78468aa4cb2/'
'usa-agricultural-exports-2011.csv')
def generate_table(dataframe, max_rows=10):
return html.Table(
# Header
[html.Tr([html.Th(col) for col in dataframe.columns])] +
# Body
[html.Tr([
html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
]) for i in range(min(len(dataframe), max_rows))]
)
server = flask.Flask(__name__)
app = dash.Dash(__name__, server=server)
app.layout = html.Div(children=[
html.H4(children='US Agriculture Exports (2011)'),
generate_table(df)
])
if __name__ == '__main__':
app.run_server(host="0.0.0.0",port=8050)