无法在Microsoft Azure上运行Dash应用程序

时间:2020-04-02 22:16:03

标签: python azure plotly-dash

我用Python构建了一个小型Dash应用程序,并成功地将其部署在Heroku上。链接在这里:https://covid19-datachallenge-uconn.herokuapp.com/

但是,我尝试在Microsoft Azure上执行相同操作,但出现以下错误。我正在使用此链接进行部署:https://www.phillipsj.net/posts/deploying-dash-to-azure-app-service/

2020-04-02T22:09:27.884279395Z Documentation: http://aka.ms/webapp-linux
2020-04-02T22:09:27.884282895Z Python 3.7.5
2020-04-02T22:09:27.884286595Z Note: Any data outside '/home' is not persisted
2020-04-02T22:09:27.945960082Z Starting OpenBSD Secure Shell server: sshd.
2020-04-02T22:09:27.957890157Z App Command Line not configured, will attempt auto-detect
2020-04-02T22:09:27.958488560Z Launching oryx with: -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -bindPort 8000
2020-04-02T22:09:27.961805781Z Oryx Version: 0.2.20200114.13, Commit: 204922f30f8e8d41f5241b8c218425ef89106d1d, ReleaseTagName: 20200114.13
2020-04-02T22:09:27.963589692Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2020-04-02T22:09:27.963980095Z Could not find operation ID in manifest. Generating an operation id...
2020-04-02T22:09:27.964420697Z Build Operation ID: bb8a66d5-6773-4d7e-b210-6f10ca6ab9f8
2020-04-02T22:09:28.553535793Z Detected an app based on Flask
2020-04-02T22:09:28.870188279Z Generating `gunicorn` command for 'application:app'
2020-04-02T22:09:29.171148066Z Writing output script to '/opt/startup/startup.sh'
2020-04-02T22:09:29.368125402Z WARNING: Could not find virtual environment directory /home/site/wwwroot/antenv.
2020-04-02T22:09:29.368839706Z WARNING: Could not find package directory /home/site/wwwroot/__oryx_packages__.
2020-04-02T22:09:29.575754204Z [2020-04-02 22:09:29 +0000] [37] [INFO] Starting gunicorn 20.0.4
2020-04-02T22:09:29.577338814Z [2020-04-02 22:09:29 +0000] [37] [INFO] Listening at: http://0.0.0.0:8000 (37)
2020-04-02T22:09:29.577878817Z [2020-04-02 22:09:29 +0000] [37] [INFO] Using worker: sync
2020-04-02T22:09:29.585273464Z [2020-04-02 22:09:29 +0000] [40] [INFO] Booting worker with pid: 40
2020-04-02T22:09:29.733903996Z [2020-04-02 22:09:29 +0000] [40] [ERROR] Exception in worker process
2020-04-02T22:09:29.733937196Z Traceback (most recent call last):
2020-04-02T22:09:29.733943196Z   File "/opt/python/3.7.5/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-04-02T22:09:29.733947796Z     worker.init_process()
2020-04-02T22:09:29.733951396Z   File "/opt/python/3.7.5/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-04-02T22:09:29.733963096Z     self.load_wsgi()
2020-04-02T22:09:29.733967196Z   File "/opt/python/3.7.5/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-04-02T22:09:29.733970996Z     self.wsgi = self.app.wsgi()
2020-04-02T22:09:29.733974496Z   File "/opt/python/3.7.5/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-04-02T22:09:29.733978196Z     self.callable = self.load()
2020-04-02T22:09:29.733981596Z   File "/opt/python/3.7.5/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-04-02T22:09:29.733985396Z     return self.load_wsgiapp()
2020-04-02T22:09:29.733988897Z   File "/opt/python/3.7.5/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-04-02T22:09:29.733992597Z     return util.import_app(self.app_uri)
2020-04-02T22:09:29.733996097Z   File "/opt/python/3.7.5/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
2020-04-02T22:09:29.733999897Z     mod = importlib.import_module(module)
2020-04-02T22:09:29.734003497Z   File "/opt/python/3.7.5/lib/python3.7/importlib/__init__.py", line 127, in import_module
2020-04-02T22:09:29.734007097Z     return _bootstrap._gcd_import(name[level:], package, level)
2020-04-02T22:09:29.734010597Z   File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
2020-04-02T22:09:29.734014597Z   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
2020-04-02T22:09:29.734018197Z   File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
2020-04-02T22:09:29.734021797Z   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
2020-04-02T22:09:29.734025397Z   File "<frozen importlib._bootstrap_external>", line 728, in exec_module
2020-04-02T22:09:29.734029097Z   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-04-02T22:09:29.734032797Z   File "/home/site/wwwroot/application.py", line 2, in <module>
2020-04-02T22:09:29.734036497Z     import dash
2020-04-02T22:09:29.734039997Z ModuleNotFoundError: No module named 'dash'
2020-04-02T22:09:29.738362924Z [2020-04-02 22:09:29 +0000] [40] [INFO] Worker exiting (pid: 40)
2020-04-02T22:09:29.782459201Z [2020-04-02 22:09:29 +0000] [37] [INFO] Shutting down: Master
2020-04-02T22:09:29.783424607Z [2020-04-02 22:09:29 +0000] [37] [INFO] Reason: Worker failed to boot.


2020-04-02 22:09:30.001 ERROR - Container covid19-datachallenge-uconn_0_8ceb9c66 for site covid19-datachallenge-uconn has exited, failing site start
2020-04-02 22:09:30.004 ERROR - Container covid19-datachallenge-uconn_0_8ceb9c66 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
2020-04-02 22:09:30.014 INFO  - Stoping site covid19-datachallenge-uconn because it failed during startup.

我可以看到它正在发生,因为它无法导入破折号。该应用程序在我的本地主机和虚拟环境(按博客为Azure部署创建的)上运行良好

请帮助!

1 个答案:

答案 0 :(得分:0)

在Azure Web应用程序的``配置''设置中,以 gunicorn application:app.server -b:8000

的形式提供启动命令

enter image description here