Я пытаюсь настроить приложение Da sh на Flask с сервером IIS и WFastCGI на Anaconda. Что я мог упустить, чтобы он не смог найти требуемый JS? Я тестировал простые Flask приложения на сервере, и все работает нормально.
- Версия сервера IIS: 8.0
- Flask = 1.1.1
- Dash = 1.8.0
- python 3.6.8
Я также пытался использовать app.css.config.serve_locally = False
и app.scripts.config.serve_locally = False
Но это не работает независимо от того, являются ли оба значения true / false.
Я также попробовал приведенный ниже вариант для создания сервера и объекта приложения.
server = flask.Flask(__name__)
app = dash.Dash(__name__, server=server)
Ниже приведен мой код.
import dash
import dash_core_components as dcc
import dash_html_components as html
# external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__)#, external_stylesheets=external_stylesheets)
server = app.server
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)
Ошибки приведены ниже chrome console.
GET http://127.0.0.1/_dash-component-suites/dash_renderer/polyfill@7.v1_2_3m1580483115.7.0.min.js net::ERR_ABORTED 404 (Not Found)
flask:22 GET http://127.0.0.1/_dash-component-suites/dash_renderer/react-dom@16.v1_2_3m1580483115.8.6.min.js net::ERR_ABORTED 404 (Not Found)
flask:21 GET http://127.0.0.1/_dash-component-suites/dash_renderer/react@16.v1_2_3m1580483115.8.6.min.js net::ERR_ABORTED 404 (Not Found)
flask:23 GET http://127.0.0.1/_dash-component-suites/dash_renderer/prop-types@15.v1_2_3m1580483115.7.2.min.js net::ERR_ABORTED 404 (Not Found)
flask:24 GET http://127.0.0.1/_dash-component-suites/dash_core_components/dash_core_components.v1_7_0m1580483133.min.js net::ERR_ABORTED 404 (Not Found)
flask:25 GET http://127.0.0.1/_dash-component-suites/dash_core_components/dash_core_components-shared.v1_7_0m1580483133.js net::ERR_ABORTED 404 (Not Found)
flask:26 GET http://127.0.0.1/_dash-component-suites/dash_html_components/dash_html_components.v1_0_2m1573845875.min.js net::ERR_ABORTED 404 (Not Found)
flask:27 GET http://127.0.0.1/_dash-component-suites/dash_renderer/dash_renderer.v1_2_3m1580483115.min.js net::ERR_ABORTED 404 (Not Found)
flask:22 GET http://127.0.0.1/_dash-component-suites/dash_renderer/react-dom@16.v1_2_3m1580483115.8.6.min.js net::ERR_ABORTED 404 (Not Found)
flask:23 GET http://127.0.0.1/_dash-component-suites/dash_renderer/prop-types@15.v1_2_3m1580483115.7.2.min.js net::ERR_ABORTED 404 (Not Found)
flask:24 GET http://127.0.0.1/_dash-component-suites/dash_core_components/dash_core_components.v1_7_0m1580483133.min.js net::ERR_ABORTED 404 (Not Found)
flask:25 GET http://127.0.0.1/_dash-component-suites/dash_core_components/dash_core_components-shared.v1_7_0m1580483133.js net::ERR_ABORTED 404 (Not Found)
flask:26 GET http://127.0.0.1/_dash-component-suites/dash_html_components/dash_html_components.v1_0_2m1573845875.min.js net::ERR_ABORTED 404 (Not Found)
flask:27 GET http://127.0.0.1/_dash-component-suites/dash_renderer/dash_renderer.v1_2_3m1580483115.min.js net::ERR_ABORTED 404 (Not Found)
flask:28 Uncaught ReferenceError: DashRenderer is not defined
at flask:28
Сгенерированный код веб-страницы, как показано ниже:
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<title>Dash</title>
<link rel="icon" type="image/x-icon" href="/_favicon.ico?v=1.8.0">
</head>
<body>
<div id="react-entry-point">
<div class="_dash-loading">
Loading...
</div>
</div>
<footer>
<script id="_dash-config" type="application/json">{"url_base_pathname": null, "requests_pathname_prefix": "/", "ui": false, "props_check": false, "show_undo_redo": false}</script>
<script src="/_dash-component-suites/dash_renderer/polyfill@7.v1_2_3m1580483115.7.0.min.js"></script>
<script src="/_dash-component-suites/dash_renderer/react@16.v1_2_3m1580483115.8.6.min.js"></script>
<script src="/_dash-component-suites/dash_renderer/react-dom@16.v1_2_3m1580483115.8.6.min.js"></script>
<script src="/_dash-component-suites/dash_renderer/prop-types@15.v1_2_3m1580483115.7.2.min.js"></script>
<script src="/_dash-component-suites/dash_core_components/dash_core_components.v1_7_0m1580483133.min.js"></script>
<script src="/_dash-component-suites/dash_core_components/dash_core_components-shared.v1_7_0m1580483133.js"></script>
<script src="/_dash-component-suites/dash_html_components/dash_html_components.v1_0_2m1573845875.min.js"></script>
<script src="/_dash-component-suites/dash_renderer/dash_renderer.v1_2_3m1580483115.min.js"></script>
<script id="_dash-renderer" type="application/javascript">var renderer = new DashRenderer();</script>
</footer>
</body>
</html>