【发布时间】:2018-07-06 01:29:17
【问题描述】:
老实说,我真的被困在这里了。我和一位同事在过去一天左右一直在研究这个问题,但我们不知道如何让 python 文件与 Twisted Web 一起使用。 Twisted web 是一个带有内置 WSGI 容器的独立服务器,所以我想让 python 文件中的图形在 8080 端口可用
这是我用来运行使用twisted web 的应用程序的命令行。是的,它在命令行上拼写为“twistd web”。
twistd web --wsgi civfdemo.py --port tcp:8080
下面是 civfdemo.py 文件。命令行和 python 文件中的正确语法是什么? 目前,我得到的错误信息如下: 没有这样的 WSGI 应用程序:'civfdemo.py'
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
server = app.server
text_style = dict(color='#444', fontFamily='sans-serif', fontWeight=300)
plotly_fig = [dict(x=[1,2,3], y=[2,4,8])]
app.layout = html.Div(children=[
html.H1(children='CIVF'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
html.P('Enter a Plotly trace type into the text box,' \
'such as histogram, bar, or scatter.', style=text_style),
dcc.Graph(id='plot1',
figure = {
'data' : plotly_fig , 'layout' : {
'title' : 'Test Progress'
}
}
)
])
if __name__ == '__main__':
app.server.run()
【问题讨论】:
标签: python wsgi twisted.web plotly-dash