Python 我无法使用Twisted Web服务器执行dash plotly文件

Python 我无法使用Twisted Web服务器执行dash plotly文件,python,wsgi,twisted.web,plotly-dash,Python,Wsgi,Twisted.web,Plotly Dash,老实说,我真的被困在这里了。在过去的一天左右,我和一位同事一直在研究这个问题,我们不知道如何使用TwistedWeb获得python文件。Twisted web是一个带有内置WSGI容器的独立服务器,因此我想让python文件中的图在端口8080处可用 这是我用来运行使用TwistedWeb的应用程序的命令行。是的,它在命令行上拼写为“twistd web” twistd web --wsgi civfdemo.py --port tcp:8080 下面是civfdemo.py文件。命令行和p

老实说,我真的被困在这里了。在过去的一天左右,我和一位同事一直在研究这个问题,我们不知道如何使用TwistedWeb获得python文件。Twisted web是一个带有内置WSGI容器的独立服务器,因此我想让python文件中的图在端口8080处可用

这是我用来运行使用TwistedWeb的应用程序的命令行。是的,它在命令行上拼写为“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()
解决方案(通过GusG):

又花了一整天的时间,我终于在一位同事的帮助下让它工作了,但取而代之的是使用了一个不同的软件包。作为Python新手,当然还有Dash,拍拍我自己的肩膀,因为我发现了这一点。我发现了一个更简单的名为Flask Twisted的包,它将Flask和Twisted集成在一起。然后我不得不从项目中挖掘出一个老问题,因为其中一个导入行被弃用了。通过对许多例子进行分类,我终于能够在网站上使用dash显示绘图/图形。因此,我希望这可以帮助其他可能遇到类似问题的人

import flask
from flask_twisted import Twisted

from dash import Dash
import dash_core_components as dcc
import dash_html_components as html

server = flask.Flask(__name__)
app = Dash(__name__, server = server)

.... Dash code related to plots and figures

if __name__ == '__main__':
    twisted = Twisted(server)
    twisted.run(host='0.0.0.0',port=8050, debug=False)