繁体   English   中英

将 Dash 应用程序部署到 Azure - 应用程序 object 必须是可调用的

[英]Deploying Dash app to Azure - Application object must be callable

我在将仪表板应用程序部署到 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM