使用Flask应用处理Azure中的端口

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

我是一个非常新的Web开发,目前正在尝试在Microsoft Azure上部署一个Flask应用程序。部署是成功的,但网站加载了很长时间,然后就崩溃了......我在应用程序日志中得到的错误如下。

2020-04-24 11:05:10.813 INFO  - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2020-04-24 11:05:14.160 INFO  - Initiating warmup request to container <container name> for site <appname>
2020-04-24 11:05:29.738 INFO  - Waiting for response to warmup request for container <container name>. Elapsed time = 15.5776184 sec
2020-04-24 11:05:46.605 INFO  - Waiting for response to warmup request for container <container name>. Elapsed time = 32.4451731 sec
2020-04-24 11:06:02.843 INFO  - Waiting for response to warmup request for container <container name>. Elapsed time = 48.6833158 sec
2020-04-24 11:06:20.077 INFO  - Waiting for response to warmup request for container <container name>. Elapsed time = 65.9168483 sec
2020-04-24 11:06:35.755 INFO  - Waiting for response to warmup request for container <container name>. Elapsed time = 81.5946978 sec
2020-04-24 11:06:51.273 INFO  - Waiting for response to warmup request for container <container name>. Elapsed time = 97.1126494 sec
2020-04-24 11:07:06.740 INFO  - Waiting for response to warmup request for container <container name>. Elapsed time = 112.5797427 sec
2020-04-24 11:07:22.295 INFO  - Waiting for response to warmup request for container <container name>. Elapsed time = 128.1349342 sec
2020-04-24 11:09:28.785 ERROR - Container <container name> for site <appname> did not start within expected time limit. Elapsed time = 254.6249399 sec
2020-04-24 11:09:28.833 ERROR - Container <container name> didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
2020-04-24 11:09:29.008 INFO  - Stoping site <appname> because it failed during startup.

我漏了什么?

在我的main.py文件中,我设置了app.run(debug=True);所以没有指定端口和主机,这样可以吗?在Cloud Shell中我设置了。

az webapp config appsettings set --resource-group <resource-group-name> --name <app-name> --settings WEBSITES_PORT=8000

有人知道问题出在哪里吗?

万事如意,snowe

azure docker flask port web-deployment
1个回答
0
投票

在Azure应用服务(Web App)上托管你的Webapp,你只能用80和443端口工作。如果你需要自定义端口,你需要使用Azure虚拟机来托管你的应用程序。

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