繁体   English   中英

Heroku 应用程序错误 - 代码=H10 desc="应用程序崩溃"

[英]Heroku Application Error - code=H10 desc="App crashed"

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

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

在此处输入图片说明

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 并发布日志 --tails 它将显示您的错误类型 H10 是由于缺少依赖项的某些错误或您的 procfiles 未正确设置而导致的错误类型,因此请尝试阅读错误类型并查看您的代码。 如果您的应用在本地主机上运行良好,请尝试使用 web:gunicorn index:server --preload --timeout60。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM