简体   繁体   English

Heroku 应用成功部署,但收到应用错误

[英]Heroku app successfully deploying, but receiving application error

I am new with pyhton, an I tried to deploy my simple app on Heroku (deployment logs) but I got and error:我是 pyhton 的新手,我尝试在 Heroku(部署日志)上部署我的简单应用程序,但出现错误:

Application error An error occurred in the application and your page could not be served.应用程序错误 应用程序发生错误,无法提供您的页面。 If you are the application owner, check your logs for details.如果您是应用程序所有者,请检查您的日志以了解详细信息。 You can do this from the Heroku CLI with the command heroku logs --tail您可以使用命令 heroku logs --tail 从 Heroku CLI 执行此操作

Deploy log:部署日志:

-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/python                                                                                                                             -----> Python app detected
-----> Using Python version specified in runtime.txt
!     Python has released a security update! Please consider upgrading to python-3.8.13
Learn More: https://devcenter.heroku.com/articles/python-runtimes
-----> No change in requirements detected, installing from cache
-----> Using cached install of python-3.8.12
-----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0
-----> Installing SQLite3
-----> Installing requirements with pip
-----> Discovering process typesProcfile declares types -> web
-----> Compressing...Done: 230.1M
-----> Launching...Released v10
https://penguins-web-app.herokuapp.com/ deployed to Heroku

The deploying log is ok, but I cant find a possible problem (sorry for the silly question).部署日志没问题,但我找不到可能的问题(抱歉这个愚蠢的问题)。

LOG Detailed:日志详细:

2022-03-29T00:11:57.794613+00:00 app[api]: Initial release by user atilio.grondoa@ufrgs.br
2022-03-29T00:11:57.794613+00:00 app[api]: Release v1 created by user atilio.grondona@ufrgs.br
2022-03-29T00:11:57.973779+00:00 app[api]: Enable Logplex by user atilio.grondona@ufrgs.br
2022-03-29T00:11:57.973779+00:00 app[api]: Release v2 created by user atilio.grondona@ufrgs.br
2022-03-29T00:15:40.000000+00:00 app[api]: Build started by user atilio.grondona@ufrgs.br
2022-03-29T00:16:46.591350+00:00 app[api]: Release v3 created by user atilio.grondona@ufrgs.br
2022-03-29T00:16:46.591350+00:00 app[api]: Deploy d008069a by user atilio.grondona@ufrgs.br
2022-03-29T00:16:46.607351+00:00 app[api]: Scaled to web@1:Free by user atilio.grondona@ufrgs.br
2022-03-29T00:17:03.515239+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run pinguins-app.py`
2022-03-29T00:17:05.173635+00:00 app[web.1]: setup.sh: 2:
2022-03-29T00:17:07.198607+00:00 app[web.1]: Traceback (most recent call last):
2022-03-29T00:17:07.199093+00:00 app[web.1]: File "/app/.heroku/python/bin/streamlit", line 8, in <module>
2022-03-29T00:17:07.199263+00:00 app[web.1]: sys.exit(main())
2022-03-29T00:17:07.199278+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
2022-03-29T00:17:07.199694+00:00 app[web.1]: return self.main(*args, **kwargs)
2022-03-29T00:17:07.199708+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1055, in main
2022-03-29T00:17:07.200079+00:00 app[web.1]: rv = self.invoke(ctx)
2022-03-29T00:17:07.200093+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
2022-03-29T00:17:07.200604+00:00 app[web.1]: return _process_result(sub_ctx.command.invoke(sub_ctx))
2022-03-29T00:17:07.200620+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
2022-03-29T00:17:07.201079+00:00 app[web.1]: return ctx.invoke(self.callback, **ctx.params)
2022-03-29T00:17:07.201094+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 760, in invoke
2022-03-29T00:17:07.201423+00:00 app[web.1]: return __callback(*args, **kwargs)
2022-03-29T00:17:07.201441+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/streamlit/cli.py", line 172, in main_run
2022-03-29T00:17:07.201594+00:00 app[web.1]: bootstrap.load_config_options(flag_options=kwargs)
2022-03-29T00:17:07.201609+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/streamlit/bootstrap.py", line 318, in load_config_options
2022-03-29T00:17:07.201799+00:00 app[web.1]: config.get_config_options(force_reparse=True, options_from_flags=options_from_flags)
2022-03-29T00:17:07.201814+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/streamlit/config.py", line 1020, in get_config_options
2022-03-29T00:17:07.202187+00:00 app[web.1]: _update_config_with_toml(file_contents, filename)
2022-03-29T00:17:07.202202+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/streamlit/config.py", line 897, in _update_config_with_toml
2022-03-29T00:17:07.202538+00:00 app[web.1]: parsed_config_file = toml.loads(raw_toml)
2022-03-29T00:17:07.202553+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/toml/decoder.py", line 213, in loads
2022-03-29T00:17:07.202700+00:00 app[web.1]: raise TomlDecodeError("Key name found without value."
2022-03-29T00:17:07.202774+00:00 app[web.1]: toml.decoder.TomlDecodeError: Key name found without value. Reached end of line. (line 1 column 2 char 1)
2022-03-29T00:17:07.765837+00:00 heroku[web.1]: Process exited with status 1
2022-03-29T00:17:07.828776+00:00 heroku[web.1]: State changed from starting to crashed
2022-03-29T00:17:07.835310+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-29T00:17:19.895825+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run pinguins-app.py`
2022-03-29T00:17:20.942050+00:00 app[web.1]: setup.sh: 2:
2022-03-29T00:17:22.226349+00:00 app[web.1]: Traceback (most recent call last):
2022-03-29T00:17:22.226369+00:00 app[web.1]: File "/app/.heroku/python/bin/streamlit", line 8, in <module>
2022-03-29T00:17:22.226447+00:00 app[web.1]: sys.exit(main())
2022-03-29T00:17:22.226459+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
2022-03-29T00:17:22.226813+00:00 app[web.1]: return self.main(*args, **kwargs)
2022-03-29T00:17:22.226824+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1055, in main
2022-03-29T00:17:22.227152+00:00 app[web.1]: rv = self.invoke(ctx)
2022-03-29T00:17:22.227168+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
2022-03-29T00:17:22.227604+00:00 app[web.1]: return _process_result(sub_ctx.command.invoke(sub_ctx))
2022-03-29T00:17:22.227617+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
2022-03-29T00:17:22.228023+00:00 app[web.1]: return ctx.invoke(self.callback, **ctx.params)
2022-03-29T00:17:22.228025+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 760, in invoke
2022-03-29T00:17:22.228267+00:00 app[web.1]: return __callback(*args, **kwargs)
2022-03-29T00:17:22.228282+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/streamlit/cli.py", line 172, in main_run
2022-03-29T00:17:22.228388+00:00 app[web.1]: bootstrap.load_config_options(flag_options=kwargs)
2022-03-29T00:17:22.228391+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/streamlit/bootstrap.py", line 318, in load_config_options
2022-03-29T00:17:22.228539+00:00 app[web.1]: config.get_config_options(force_reparse=True, options_from_flags=options_from_flags)
2022-03-29T00:17:22.228550+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/streamlit/config.py", line 1020, in get_config_options
2022-03-29T00:17:22.228856+00:00 app[web.1]: _update_config_with_toml(file_contents, filename)
2022-03-29T00:17:22.228868+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/streamlit/config.py", line 897, in _update_config_with_toml
2022-03-29T00:17:22.229139+00:00 app[web.1]: parsed_config_file = toml.loads(raw_toml)
2022-03-29T00:17:22.229150+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/toml/decoder.py", line 213, in loads
2022-03-29T00:17:22.229256+00:00 app[web.1]: raise TomlDecodeError("Key name found without value."
2022-03-29T00:17:22.229283+00:00 app[web.1]: toml.decoder.TomlDecodeError: Key name found without value. Reached end of line. (line 1 column 2 char 1)
2022-03-29T00:17:22.524612+00:00 heroku[web.1]: Process exited with status 1
2022-03-29T00:17:22.576376+00:00 heroku[web.1]: State changed from starting to crashed
2022-03-29T00:17:24.000000+00:00 app[api]: Build succeeded
2022-03-29T00:17:27.995087+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=web-penguin.herokuapp.com request_id=7aab630c-d2c
d-4b79-90a4-cb2057d7322f fwd="189.6.210.213" dyno= connect= service= status=503
bytes= protocol=https
2022-03-29T00:17:28.921373+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=web-penguin.herokuapp.com request_id=3
1c1f9ef-b3c0-439d-ae94-885a17afaf14 fwd="189.6.210.213" dyno= connect= service=status=503 bytes= protocol=https

My python code:我的 python 代码:

import streamlit as st
import pandas as pd
from sklearn import datasets
from sklearn.ensemble import RandomForestClassifier

st.write("""
# Simple Iris Flower Prediction App
This app predicts the **Iris flower** type!
""")

st.sidebar.header('User Input Parameters')

def user_input_features():
    sepal_length = st.sidebar.slider('Sepal length', 4.3, 7.9, 5.4)
    sepal_width = st.sidebar.slider('Sepal width', 2.0, 4.4, 3.4)
    petal_length = st.sidebar.slider('Petal length', 1.0, 6.9, 1.3)
    petal_width = st.sidebar.slider('Petal width', 0.1, 2.5, 0.2)
    data = {'sepal_length': sepal_length,
            'sepal_width': sepal_width,
            'petal_length': petal_length,
            'petal_width': petal_width}
    features = pd.DataFrame(data, index=[0])
    return features

df = user_input_features()

st.subheader('User Input parameters')
st.write(df)

iris = datasets.load_iris()
X = iris.data
Y = iris.target

clf = RandomForestClassifier()
clf.fit(X, Y)

prediction = clf.predict(df)
prediction_proba = clf.predict_proba(df)

st.subheader('Class labels and their corresponding index number')
st.write(iris.target_names)

st.subheader('Prediction')
st.write(iris.target_names[prediction])
#st.write(prediction)

st.subheader('Prediction Probability')
st.write(prediction_proba)

My file system dont have the config.toml, int the flher.streamlit/ there is 2 files.stable_random_id and credentials (the last one I delete it).我的文件系统没有 config.toml,在 flher.streamlit/ 中有 2 个 files.stable_random_id 和凭据(最后一个我删除了它)。 I tryied to create by my own the config.toml but not worked anyway.我尝试自己创建 config.toml 但无论如何都没有用。 I used this in the config.toml:我在 config.toml 中使用了这个:

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

@ferdy here is the log error message of heroku: @ferdy这里是heroku的日志错误信息:

Heroku log error Heroku 日志错误

Based just on the sample here it looks like you've bound it to a version of python that has a known security issue, but otherwise I don't see any errors in the sample here.仅根据此处的示例,您似乎已将其绑定到具有已知安全问题的 python 版本,但除此之外,我在此处的示例中看不到任何错误。 If you update your requirements to 3.8.13, it should get rid of the error, since there's 85 vulnerabilities in 3.8.12.如果将要求更新到 3.8.13,应该可以消除错误,因为 3.8.12 中有 85 个漏洞。

I can successfully deploy in heroku with your code.我可以使用您的代码在 heroku 中成功部署。

link: https://stdemo.herokuapp.com/ [deleted]链接: https://stdemo.herokuapp.com/ [已删除]

requirements.txt要求.txt

streamlit==1.8.0
scikit-learn==1.0.2
click==8.0.4

Procfile简介

web: sh setup.sh && streamlit run app.py

setup.sh安装程序.sh

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

app.py应用程序.py
Use your code.使用您的代码。

Problem solved: use CLI to deploy and work fine.问题已解决:使用 CLI 部署并正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Heroku 应用程序成功部署,但在加载站点时收到应用程序错误 - Heroku app successfully deploying, but receiving an application error when loading site Heroku 应用成功部署,但加载站点时收到应用程序错误 - Heroku app successfully deploying, but receiving application error when loading site Heroku 应用程序成功部署,但在加载站点时收到应用程序错误。 但我似乎可以找到一个错误 - Heroku app successfully deploying, but receiving application error when loading site. But I can seem to find an error Heroku 应用程序成功部署,但打开应用程序时收到应用程序错误 - Heroku app successfully deployed, but receiving application error when opening app 应用程序错误:我的 Flask-web-app 已成功部署在 Heroku 上,但在加载站点时收到应用程序错误 - Application error: My Flask-web-app is successfully deploy on Heroku but receiving application error when loading site 成功部署 Django API 到 Heroku 后应用程序错误 - Application Error after successfully deploying Django API to Heroku Heroku 应用部署成功但应用报错 - Heroku app deployed successfully but Application Error 部署 Dash 应用程序时出现 Heroku 应用程序错误 - Heroku Application Error when deploying Dash app Heroku 部署 Flask 应用程序时出现“应用程序错误” - Heroku "Application error" when deploying Flask app 我在 Heroku 上成功部署了我的 Web 应用程序,但显示应用程序错误 - I successfully deployed my web app on Heroku but shows Application Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM