gpt4 book ai didi

python - 将 Dash 应用程序部署到 Azure - 应用程序对象必须可调用

转载 作者:行者123 更新时间:2023-12-02 23:25:48 25 4
gpt4 key购买 nike

我在将仪表板应用程序部署到 azure 时遇到问题。

我已将文件命名为 application.py,并且代码开头有以下内容,我还缺少什么?

app = dash.Dash()
server = app.server
2020-07-15T02:10:24.794459675Z A P P   S E R V I C E   O N   L I N U X
2020-07-15T02:10:24.794463776Z
2020-07-15T02:10:24.794467576Z Documentation: http://aka.ms/webapp-linux
2020-07-15T02:10:24.794471676Z Python 3.7.7
2020-07-15T02:10:24.794475676Z Note: Any data outside '/home' is not persisted
2020-07-15T02:10:25.516192798Z Starting OpenBSD Secure Shell server: sshd.
2020-07-15T02:10:25.598758328Z App Command Line not configured, will attempt auto-detect
2020-07-15T02:10:25.599342840Z Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -bindPort 8000
2020-07-15T02:10:26.005607153Z Found build manifest file at '/home/site/wwwroot/oryx-manifest.toml'. Deserializing it...
2020-07-15T02:10:26.017403300Z Build Operation ID: |dIT9rOZuwzA=.7809ead2_
2020-07-15T02:10:26.035129571Z Oryx Version: 0.2.20200522.2, Commit: bf724c0e83f3da74487f55cd304c63331dab7067, ReleaseTagName: 20200522.2
2020-07-15T02:10:27.985241432Z Detected an app based on Flask
2020-07-15T02:10:28.468481213Z Generating `gunicorn` command for 'application:app'
2020-07-15T02:10:29.130746361Z Writing output script to '/opt/startup/startup.sh'
2020-07-15T02:10:29.846009569Z Found virtual environment .tar.gz archive.
2020-07-15T02:10:29.846799084Z Removing existing virtual environment directory /antenv...
2020-07-15T02:10:29.888516619Z Extracting to directory /antenv...
2020-07-15T02:11:09.888367018Z Using packages from virtual environment antenv located at /antenv.
2020-07-15T02:11:09.971225254Z Updated PYTHONPATH to ':/antenv/lib/python3.7/site-packages'
2020-07-15T02:11:12.262498667Z [2020-07-15 02:11:12 +0000] [42] [INFO] Starting gunicorn 20.0.4
2020-07-15T02:11:12.265001320Z [2020-07-15 02:11:12 +0000] [42] [INFO] Listening at: http://0.0.0.0:8000 (42)
2020-07-15T02:11:12.265446929Z [2020-07-15 02:11:12 +0000] [42] [INFO] Using worker: sync
2020-07-15T02:11:12.282967396Z [2020-07-15 02:11:12 +0000] [45] [INFO] Booting worker with pid: 45
2020-07-15T02:11:18.319408889Z Application object must be callable.
2020-07-15T02:11:18.320327008Z [2020-07-15 02:11:18 +0000] [45] [INFO] Worker exiting (pid: 45)
2020-07-15T02:11:18.640154710Z [2020-07-15 02:11:18 +0000] [42] [INFO] Shutting down: Master
2020-07-15T02:11:18.640571018Z [2020-07-15 02:11:18 +0000] [42] [INFO] Reason: App failed to load.
2020-07-15T02:11:20.084Z ERROR - Container regionals3_0_1ebe0cd6 for site regionals3 has exited, failing site start
2020-07-15T02:11:20.162Z ERROR - Container regionals3_0_1ebe0cd6 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.

最佳答案

基于错误日志中的这一行

2020-07-15T02:10:28.468481213Z Generating `gunicorn` command for 'application:app'

生成的gunicorn命令似乎期望Flask服务器被命名为app。因此,如果您将代码更改为

dash_app = dash.Dash()
app = dash_app.server

我想它应该可以工作。或者,您必须将(生成的)gunicorn 命令更改为 application:server

关于python - 将 Dash 应用程序部署到 Azure - 应用程序对象必须可调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62906731/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com