无法从 az cli 部署 python 应用程序

Unable to deploy a python application from az cli

我们在使用 Az CLI 将 python 应用程序部署到应用程序服务时遇到问题。您知道问题的根源吗?

这是我们使用的命令。我们在 ubuntu VM 上执行它。 az webapp up -n $WEB_APP_NAME -l "westeurope" -g $RESOURCE_GROUP_NAME --sku B1

这是我们遇到的错误。我们不明白:

Zip deployment failed. {'id': '200a84e1e024461ca2ef18edd8c3f607', 'status': 3, 'status_text': '', 'author_email': 'N/A', 'author': 'N/A', 'deployer': 'Push-Deployer', 'message': 'Created via a push deployment', 'progress': '', 'received_time': '2021-06-22T15:49:57.8395052Z', 'start_time': '2021-06-22T15:49:59.5399261Z', 'end_time': '2021-06-22T15:50:13.4118115Z', 'last_success_end_time': None, 'complete': True, 'active': False, 'is_temp': False, 'is_readonly': True, 'url': 'https://test-surveillance-api-2.scm.azurewebsites.net/api/deployments/latest', 'log_url': 'https://test-surveillance-api-2.scm.azurewebsites.net/api/deployments/latest/log', 'site_name': 'test-surveillance-api-2'}. Please run the command az webapp log deployment show -n test-surveillance-api-2 -g azr-rg-bpceit-bpcesa-d2i2`

这里是link到full deployment log。在这些日志中,我看到了以下错误。他们不清楚哈哈。

knack.util.CLIError: Zip deployment failed. {'id': '273909f740bd44de93111b0576d235f9', 'status': 3, 'status_text': '', 'author_email': 'N/A', 'author': 'N/A', 'deployer': 'Push-Deployer', 'message': 'Created via a push deployment', 'progress': '', 'received_time': '2021-06-22T16:11:12.3912894Z', 'start_time': '2021-06-22T16:11:13.5603203Z', 'end_time': '2021-06-22T16:11:23.3248561Z', 'last_success_end_time': None, 'complete': True, 'active': False, 'is_temp': False, 'is_readonly': True, 'url': 'https://test-surveillance-api-2.scm.azurewebsites.net/api/deployments/latest', 'log_url': 'https://test-surveillance-api-2.scm.azurewebsites.net/api/deployments/latest/log', 'site_name': 'test-surveillance-api-2'}. Please run the command az webapp log deployment show -n test-surveillance-api-2 -g azr-rg-bpceit-bpcesa-d2i2
cli.azure.cli.core.azclierror : Zip deployment failed. {'id': '273909f740bd44de93111b0576d235f9', 'status': 3, 'status_text': '', 'author_email': 'N/A', 'author': 'N/A', 'deployer': 'Push-Deployer', 'message': 'Created via a push deployment', 'progress': '', 'received_time': '2021-06-22T16:11:12.3912894Z', 'start_time': '2021-06-22T16:11:13.5603203Z', 'end_time': '2021-06-22T16:11:23.3248561Z', 'last_success_end_time': None, 'complete': True, 'active': False, 'is_temp': False, 'is_readonly': True, 'url': 'https://test-surveillance-api-2.scm.azurewebsites.net/api/deployments/latest', 'log_url': 'https://test-surveillance-api-2.scm.azurewebsites.net/api/deployments/latest/log', 'site_name': 'test-surveillance-api-2'}. Please run the command az webapp log deployment show -n test-surveillance-api-2 -g azr-rg-bpceit-bpcesa-d2i2
Zip deployment failed. {'id': '273909f740bd44de93111b0576d235f9', 'status': 3, 'status_text': '', 'author_email': 'N/A', 'author': 'N/A', 'deployer': 'Push-Deployer', 'message': 'Created via a push deployment', 'progress': '', 'received_time': '2021-06-22T16:11:12.3912894Z', 'start_time': '2021-06-22T16:11:13.5603203Z', 'end_time': '2021-06-22T16:11:23.3248561Z', 'last_success_end_time': None, 'complete': True, 'active': False, 'is_temp': False, 'is_readonly': True, 'url': 'https://test-surveillance-api-2.scm.azurewebsites.net/api/deployments/latest', 'log_url': 'https://test-surveillance-api-2.scm.azurewebsites.net/api/deployments/latest/log', 'site_name': 'test-surveillance-api-2'}. Please run the command az webapp log deployment show -n test-surveillance-api-2 -g azr-rg-bpceit-bpcesa-d2i2

有关环境的更多详细信息: OS : Ubuntu 18.04.5 LTS Python 版本:3.8.7

我解决了我的问题!!

经过一些研究,我注意到问题出在 requirements.txt 和包含我的文件的存储库上。

因此,我将文件复制到另一个存储库中。我用 python 虚拟环境 (./env/bin/python3) 的 python 生成了 requirements.txt,而不是 OS.[=10 中安装的 requirements.txt =]

我不明白为什么会出现这个问题。如果有人知道,请告诉我。

祝你有美好的一天。

这里有一个替代方案,您可以使用continuous deployment. You can use git. If the code is confidential, you can also use your own to create a git storage service locally and use local git进行部署。在这种情况下,应用程序将在每次修改提交后自动部署。

有关详细信息,请参阅此 link .