簡體   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