通过 VS Code 将 python EchoBot 部署到 Azure 应用服务时出现应用程序错误。找不到模块

问题描述 投票:0回答:1

我正在尝试在 Azure 应用服务上部署基于 Bot Framework 中的 Echo Bot 的 Python 代码。

看起来它没有安装依赖项“aiohttp”。

我已经:

  • 将aiohttp放在requirements.txt中
  • 在应用程序设置中添加了 SCM_DO_BUILD_DURING_DEPLOYMENT=true。

我相信我需要创建一个部署脚本,但我不知道如何创建。

我在启动日志下方粘贴了一些可能有助于诊断我的问题的错误:

2024-06-19T17:36:11.659660467Z    _____                               

2024-06-19T17:36:11.660293903Z   /  _  \ __________ _________   ____  

2024-06-19T17:36:11.660302104Z  /  /_\  \\___   /  |  \_  __ \_/ __ \ 

2024-06-19T17:36:11.660307404Z /    |    \/    /|  |  /|  | \/\  ___/ 

2024-06-19T17:36:11.660312304Z \____|__  /_____ \____/ |__|    \___  >

2024-06-19T17:36:11.660317505Z         \/      \/                  \/ 

2024-06-19T17:36:11.660321805Z A P P   S E R V I C E   O N   L I N U X

2024-06-19T17:36:11.660325905Z 

2024-06-19T17:36:11.660330205Z Documentation: http://aka.ms/webapp-linux

2024-06-19T17:36:11.660334506Z Python 3.9.18

2024-06-19T17:36:11.660338706Z Note: Any data outside '/home' is not persisted

2024-06-19T17:36:13.810554703Z Starting OpenBSD Secure Shell server: sshd.

2024-06-19T17:36:14.333770281Z Site's appCommandLine: gunicorn --bind 0.0.0.0 --worker-class aiohttp.worker.GunicornWebWorker --timeout 600 app:APP

2024-06-19T17:36:14.354694284Z Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -userStartupCommand 'gunicorn --bind 0.0.0.0 --worker-class aiohttp.worker.GunicornWebWorker --timeout 600 app:APP'

2024-06-19T17:36:14.813647468Z Could not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'

2024-06-19T17:36:14.836126760Z Could not find operation ID in manifest. Generating an operation id...

2024-06-19T17:36:14.836167062Z Build Operation ID: 3ea9efd5-76gt-4207-98jb-b4ccb93fd

2024-06-19T17:36:15.757313818Z Oryx Version: 0.2.20240501.1, Commit: f83f88d3c, ReleaseTagName: 20240501.1

2024-06-19T17:36:15.803859894Z Writing output script to '/opt/startup/startup.sh'

2024-06-19T17:36:15.876379163Z WARNING: Could not find virtual environment directory /home/site/wwwroot/antenv.

2024-06-19T17:36:15.878094662Z WARNING: Could not find package directory /home/site/wwwroot/__oryx_packages__.

2024-06-19T17:36:21.199999677Z 

2024-06-19T17:36:21.216749143Z Error: class uri 'aiohttp.worker.GunicornWebWorker' invalid or not found: 

2024-06-19T17:36:21.216757743Z 

2024-06-19T17:36:21.216762344Z [Traceback (most recent call last):

2024-06-19T17:36:21.216766944Z   File "/opt/python/3.9.18/lib/python3.9/site-packages/gunicorn/util.py", line 111, in load_class

2024-06-19T17:36:21.216771844Z     mod = importlib.import_module('.'.join(components))

2024-06-19T17:36:21.216776544Z   File "/opt/python/3.9.18/lib/python3.9/importlib/__init__.py", line 127, in import_module

2024-06-19T17:36:21.216781145Z     return _bootstrap._gcd_import(name[level:], package, level)

2024-06-19T17:36:21.216785545Z   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import

2024-06-19T17:36:21.216790645Z   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load

2024-06-19T17:36:21.216806746Z   File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked

2024-06-19T17:36:21.216811746Z   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed

2024-06-19T17:36:21.216816347Z   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import

2024-06-19T17:36:21.216820647Z   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load

2024-06-19T17:36:21.216825147Z   File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked

2024-06-19T17:36:21.216829547Z ModuleNotFoundError: No module named 'aiohttp'

2024-06-19T17:36:21.216834048Z ]

2024-06-19T17:36:21.216838248Z 

rs-app-service-98_0_9031ba9f_middleware for site rs-app-service-98 initialized successfully and is ready to serve requests.

2024-06-19T17:36:36.343Z ERROR - Container rs-app-service-98_0_9031ba9f didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.

2024-06-19T17:36:36.481Z INFO  - Stopping site rs-app-service-98 because it failed during startup.
python visual-studio-code azure-web-app-service azure-bot-service
1个回答
0
投票

错误报告显示未找到

aiohttp
模块。确保该模块已正确安装。

请检查您的

requirements.txt
文件。确保
aiohttp
在您的
requirements.txt
文件中列出,并且该文件位于应用程序的根目录中。

© www.soinside.com 2019 - 2024. All rights reserved.