我正在使用来自这些帖子的信息在 Shinyproxy 上部署 Dash 应用程序:
https://lukesingham.com/how-to-deploy-plotlys-dash-using-shinyproxy/
不过,当应该交付静态资产时,我会遇到一些错误:
当我在 docker 容器中运行 dash 应用程序时,一切正常。网站没有错误,并且交付了静态资产。
我的文件:
应用程序.py
import dash
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ['my-style.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
html.Img(src='/assets/logo2.png'),
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'
}
}
)
])
app.config.suppress_callback_exceptions = True
app.config.update({
'routes_pathname_prefix': ''
, 'requests_pathname_prefix': ''
})
if __name__ == '__main__':
app.run_server(host='0.0.0.0', port=8050, debug=True)
应用程序.yml
port: 8080
authentication: simple
admin-groups: admins
users:
- name: admin
password: admin
groups: admins
docker:
url: http://localhost:2375
specs:
- id: DashTest
display-name: Dash Demo Application
container-cmd: ["python", "app.py"]
container-image: shiny-dash-app
port: 8050
access-groups: admins
logging:
file:
shinyproxy.log
编辑:我的代码结构如下:
dash
├── dash_shinyproxy
| ├── dashapp_shinyproxy
| ├── Dockerfile
| ├── app
| ├── assets
| ├── app.py
谁能帮我解决这个问题?有没有人推荐关于如何为闪亮代理提供静态文件的想法?
先感谢您。