您当前的位置: 首页 > 

Xavier Jiezou

暂无认证

  • 1浏览

    0关注

    394博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

记录部署 streamlit 应用时遇到的一个坑(配置文件中 headless 需设置为 true)

Xavier Jiezou 发布时间:2022-04-22 11:04:53 ,浏览量:1

问题描述

部署 streamlit 应用失败,日志信息如下:

[manager] Processed dependencies!

[manager] The service has encountered an error while checking the health of the Streamlit app: Get "http://localhost:8501/healthz": dial tcp 127.0.0.1:8501: connect: connection refused

[manager] Streamlit server consistently failed status checks

[manager] Please fix the errors, push an update to the git repo, or reboot the app.
解决方案

从日志信息中我们根本看不到任何有用的信息,也不知道为啥报错。从社区中搜索答案,发现有个网友分享了这样一个解决方案:

在这里插入图片描述

他说时把配置文件中的 headless 参数设置为 true,按照这个方案我确实解决了错误。

原因分析

这就要解释一下 headless 参数的作用了。官方给出的解释如下:

# If false, will attempt to open a browser window on start.
# Default: false unless (1) we are on a Linux box where DISPLAY is unset, or (2) we are running in the Streamlit Atom plugin.

如果为 false,将尝试在启动时打开浏览器窗口。默认 false,以下两种情况需要设置为 true

  • (1)我们使用的是未设置 Display 的 Linux 机器
  • (2)我们正在 Streamlight Atom 插件中运行。

部署一个 web 应用是在 Linux 主机上进行的,符合第一种情况,所以需要设置为 true

引用参考

https://discuss.streamlit.io/t/manager-streamlit-server-consistently-failed-status-checks/11737/11

关注
打赏
1661408149
查看更多评论
立即登录/注册

微信扫码登录

0.0380s