有没有办法在不使用 Docker 的情况下在 Azure 应用服务上部署 Streamlit 应用程序? 互联网上的所有指南都提到 Docker 虚拟化,而理论上,Azure Web App 应该能够从 Azure Repo 自动部署代码。我在 Azure 配置选项卡中使用“streamlit run app.py”作为启动命令,但什么也没发生。
最佳答案
您可以通过设置普通的 Steamlit 应用程序并添加应用程序服务特定配置来实现此目的。具体步骤如下:
创建定价层 B1 或更高的 Azure 应用服务。免费版本(F1)不支持Streamlit所需的websocket。
为项目创建一个文件夹。并添加
requirements.txt
并包含以下内容。流线型
将此文件夹部署到 Azure 应用服务。
进行以下配置更改。在
配置>常规设置>启动命令
下提供以下值python -m Streamlit hello --server.port 8000 --server.address 0.0.0.0
在 Azure 应用服务配置中启用 Web Sockets。
Azure only allows pip binaries to run when used as modules instead of directly. We are mentioning port beacuse by default the service listens to port 8000. We are mentioning the server.address as 0.0.0.0 so that the it can serve all the incoming request from azure infra.
关于azure - 在不使用 Docker 的情况下在 Azure 中部署 Streamlit 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72442371/