我正在使用Gunicorn部署我的Dash应用程序。升级到Gunicorn 20.0.0后,找不到我的应用程序。
onclick
gunicorn --bind=0.0.0.0 --timeout 600 index:app.server
This issue on Gunicorn's issue tracker似乎与该错误有关,但是我不知道该如何解决。如何让Gunicorn 20找到我的应用?
Failed to find application object 'app.server' in 'index'
[INFO] Shutting down: Master
[INFO] Reason: App failed to load.
:
index.py
import os
from dash.dependencies import Input,Output
import dash_core_components as dcc
import dash_html_components as html
from pages import overview
from webapp import app
app.index_string = open(os.path.join("html","index.html")).read()
app.layout = html.Div([
dcc.Location(id="url",refresh=False),html.Div(id="page-content")
])
@app.callback(Output("page-content","children"),[Input("url","pathname")])
def display_page(pathname):
if pathname == "/a-service/overview":
return overview.layout
else:
return overview.layout
if __name__ == "__main__":
app.run_server(debug=True,port=8051)
:
webapp.py