4

我是heroku的新手 该应用程序在python 3.7中,并使用streamlit、bokeh和pandas 我已经成功部署了一个python streamlit应用程序,但是当我尝试打开它时出现以下错误。我无法理解 255 错误和行:

Found invalid character in key name: '['. Try quoting the key name.

如果有人可以提供帮助,我会很高兴。这是日志文件:

C:\Users\imall\Desktop\projects\app>heroku logs --tail
2020-06-05T17:31:11.476321+00:00 app[api]: Release v1 created by user xxx@gmail.com
2020-06-05T17:31:11.476321+00:00 app[api]: Initial release by user xxx@gmail.com
2020-06-05T17:31:11.710688+00:00 app[api]: Release v2 created by user xxx@gmail.com
2020-06-05T17:31:11.710688+00:00 app[api]: Enable Logplex by user xxx@gmail.com
2020-06-05T17:31:44.000000+00:00 app[api]: Build started by user xxx@gmail.com
2020-06-05T17:33:09.232663+00:00 app[api]: Release v3 created by user xxx@gmail.com
2020-06-05T17:33:09.232663+00:00 app[api]: Deploy 5e76f3fe by user xxx@gmail.com
2020-06-05T17:33:09.252408+00:00 app[api]: Scaled to web@1:Free by user xxx@gmail.com
2020-06-05T17:33:18.820397+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run dvh-app2.py`2020-06-05T17:33:26.600593+00:00 app[web.1]: Found invalid character in key name: '['. Try quoting the key name. (line 1 column 2 char 1)
2020-06-05T17:33:26.896489+00:00 heroku[web.1]: Process exited with status 255
2020-06-05T17:33:26.948655+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-05T17:33:26.950770+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-05T17:33:28.000000+00:00 app[api]: Build succeeded
2020-06-05T17:33:34.441164+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run dvh-app2.py`2020-06-05T17:33:37.916979+00:00 app[web.1]: Found invalid character in key name: '['. Try quoting the key name. (line 1 column 2 char 1)
2020-06-05T17:33:38.070801+00:00 heroku[web.1]: Process exited with status 255
2020-06-05T17:33:38.122656+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-05T17:34:17.202049+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=young-fjord-43109.herokuapp.com request_id=0bc3422d-0718-4741-a062-dcd941990312 fwd="110.227.109.220" dyno= connect= service= status=503 bytes= protocol=https
2020-06-05T17:34:18.031087+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=young-fjord-43109.herokuapp.com request_id=c480e478-484c-417a-8b31-5a6c42128b6f fwd="110.227.109.220" dyno= connect= service= status=503 bytes= protocol=https

我的 setup.sh 文件如下:

mkdir -p ~/.streamlit/

echo “\
[general]\n\
email = \”xxx@gmail.com\”\n\
“ > ~/.streamlit/credentials.toml

echo “\
[server]\n\
headless = true\n\
enableCORS=false\n\
port = $PORT\n\
“ > ~/.streamlit/config.toml

我的Procfile如下:

sh setup.sh && streamlit run dvh-app2.py

我的 requirements.txt 文件如下:

streamlit==0.49.0
bokeh==2.0.1
pandas==0.24.2
numpy==1.17.3
4

1 回答 1

8

好的,我自己想通了:问题出在我的 setup.sh 文件上。像这样重新格式化后:

mkdir -p ~/.streamlit

echo "[server]
headless = true
port = $PORT
enableCORS = false
" > ~/.streamlit/config.toml

它没有任何问题。

于 2020-06-16T16:45:40.967 回答