gpt4 book ai didi

Heroku 应用程序错误 - 代码=H10 desc ="App crashed"

转载 作者:行者123 更新时间:2023-12-05 07:16:53 29 4
gpt4 key购买 nike

我正在尝试在 heroku 上部署一个 dash 应用程序。

一切正常(也在本地),除了当我运行 heroku open 我得到这个应用程序错误:

enter image description here

heroku logs --tail 然后给出:

2019-11-22T22:55:41.598239+00:00 heroku[web.1]: State changed from up to crashed
2019-11-22T22:55:41.587218+00:00 heroku[web.1]: Process exited with status 3
2019-11-22T22:55:42.000000+00:00 app[api]: Build succeeded
2019-11-22T22:55:59.485489+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=romania2019.herokuapp.com request_id=d48fde4a-bd7e-47e2-9a21-bdf589ef281a fwd="152.115.83.242" dyno= connect= service= status=503 bytes= protocol=https
2019-11-22T22:55:59.851491+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=romania2019.herokuapp.com request_id=b6bbb5e8-8667-42f2-b083-b7bf26b5ae14 fwd="152.115.83.242" dyno= connect= service= status=503 bytes= protocol=https

我下一步应该看哪里有什么建议吗?


这是我正在尝试部署的 app.py:

import datetime
import time

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly
from dash.dependencies import Input, Output

import numpy as np
from selenium import webdriver

url = 'https://prezenta.bec.ro/prezidentiale24112019/abroad-precincts'


profile = webdriver.FirefoxProfile()
profile.set_preference("browser.preferences.instantApply",True)
profile.set_preference("browser.helperApps.neverAsk.saveToDisk",
"text/plain, application/octet-stream, application/binary, text/csv, application/csv, application/excel, text/comma-separated-values, text/xml, application/xml")
profile.set_preference("browser.helperApps.alwaysAsk.force",False)
profile.set_preference("browser.download.manager.showWhenStarting",False)
profile.set_preference("browser.download.folderList",1)


options = webdriver.FirefoxOptions()
options.headless = True

# create a new Firefox session
driver = webdriver.Firefox(firefox_profile=profile, options=options)
driver.implicitly_wait(30)
driver.get(url)

# Find button and click on it
ELEMENT = driver.find_element_by_xpath('//*[@id="root"]/main/section/div[1]/div[1]/div[5]/div/div[2]/div/h2')

def update(ELEMENT):
# time.sleep(2.9)
return int(ELEMENT.text.replace('.', ''))


external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

server = app.server

app.layout = html.Div(
html.Div([
html.H4('ROMANIA - Presidential Elections Live Feed'),
html.Div(id='live-update-text'),
dcc.Graph(id='live-update-graph'),
dcc.Interval(
id='interval-component',
interval=60*1000, # in milliseconds
n_intervals=0
)
])
)

time.sleep(5)
@app.callback(Output('live-update-text', 'children'),
[Input('interval-component', 'n_intervals')])
def update_metrics(n):
no = update(ELEMENT)
style = {'padding': '5px', 'fontSize': '16px'}
return [
html.Span('Voters: {}'.format(no), style=style),
html.Span('Voters/Min: {}'.format(np.diff(data['number'])[-5:].mean()), style=style)
]


data = {'time': [], 'number': []}

# Multiple components can update everytime interval gets fired.
@app.callback(Output('live-update-graph', 'figure'),
[Input('interval-component', 'n_intervals')])
def update_graph_live(n):
# Collect some data
data['time'].append(datetime.datetime.now()) # + datetime.timedelta(seconds=3))

try:
no = update(ELEMENT)
data['number'].append(no)
except:
data['number'].append(no)



# Create the graph with subplots
fig = plotly.subplots.make_subplots(rows=2, cols=1, vertical_spacing=0.1)
fig['layout']['margin'] = {
'l': 30, 'r': 10, 'b': 30, 't': 10
}
fig['layout']['legend'] = {'x': 0, 'y': 1, 'xanchor': 'left'}

fig.append_trace({
'x': data['time'],
'y': data['number'],
'name': 'Voters',
'type': 'scatter'
}, 1, 1)
fig.append_trace({
'x': data['time'],
'y': np.diff(data['number']),
'text': data['time'],
'name': 'Voters / Min',
'type': 'scatter'
}, 2, 1)
fig.layout.update(height=800, )

return fig


if __name__ == '__main__':
app.run_server(debug=True)

它基本上是读取选民人数并显示每分钟的投票数。

这里给出了我一直遵循的部署说明:https://dash.plot.ly/deployment .

最佳答案

打开你的 git bash 并发布log --tails 它会显示你的错误类型 H10 is app crasing due to some error missing dependencies or your procfiles is not set well so try reading the error types and look in your code.如果您的应用程序在您的本地主机上运行良好,请尝试网络:gunicorn 索引:服务器 --preload --timeout60。

关于Heroku 应用程序错误 - 代码=H10 desc ="App crashed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59002893/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com