繁体   English   中英

如何解决 heroku flask 应用程序上的应用程序错误?

[英]how do i solve the application error on heroku flask app?

大家好。

我在 heroku flask 应用程序上有一个“应用程序错误”

我什至不知道我应该展示什么,所以我只想展示这个:

2020-12-12T16:34:38.202986+00:00 app[api]: Release v1 created by user alainelomapro@gmail.com
2020-12-12T16:34:38.202986+00:00 app[api]: Initial release by user alainelomapro@gmail.com
2020-12-12T16:34:38.324998+00:00 app[api]: Enable Logplex by user alainelomapro@gmail.com
2020-12-12T16:34:38.324998+00:00 app[api]: Release v2 created by user alainelomapro@gmail.com
2020-12-12T16:34:52.671625+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=intothedetails.herokuapp.com request_id=3dc38ea0-3274-482b-ab25-54810e644c66 fwd="105.178.116.156" dyno= connect= service= status=502 bytes= protocol=https
2020-12-12T16:34:54.553310+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=702f1c13-272d-477c-9a1e-3e608f91bbce fwd="105.178.116.156" dyno= connect= service= status=502 bytes= protocol=https
2020-12-12T17:24:46.000000+00:00 app[api]: Build started by user alainelomapro@gmail.com
2020-12-12T17:25:09.806664+00:00 app[api]: Release v3 created by user alainelomapro@gmail.com
2020-12-12T17:25:09.806664+00:00 app[api]: Deploy fdbeb30b by user alainelomapro@gmail.com
2020-12-12T17:25:09.824291+00:00 app[api]: Scaled to web@1:Free by user alainelomapro@gmail.com
2020-12-12T17:25:12.858841+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T17:25:14.431343+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T17:25:14.462293+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T17:25:14.466111+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T17:25:17.000000+00:00 app[api]: Build succeeded
2020-12-12T17:25:17.698991+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T17:25:20.343513+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T17:25:20.378595+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T17:26:32.998759+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=d2ae02c5-e68e-48dc-aa2b-a15bec775253 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:26:34.694736+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=2386321c-000a-426d-a7dc-15a463db822f fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:27:56.030578+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=52f251df-6be0-4a17-99e9-64d4fc03b07c fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:27:56.967195+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=95c61b41-e203-4bdf-801e-47fa99d12c90 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:38:22.000000+00:00 app[api]: Build started by user alainelomapro@gmail.com
2020-12-12T17:38:46.996007+00:00 app[api]: Release v4 created by user alainelomapro@gmail.com
2020-12-12T17:38:46.996007+00:00 app[api]: Deploy 0bb4e9a7 by user alainelomapro@gmail.com
2020-12-12T17:38:48.418866+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T17:38:51.556021+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T17:38:53.798514+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T17:38:53.849825+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T17:38:53.853438+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T17:38:54.000000+00:00 app[api]: Build succeeded
2020-12-12T17:38:58.631983+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T17:39:02.685672+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T17:39:02.728577+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T17:40:23.683784+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=f863ea53-d07f-45d0-a52f-d5a240ae8375 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:40:25.405822+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=9b859b32-8798-4ffe-bf17-9c5e2cb1081c fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:43:26.685628+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=1f046546-456a-4aa3-99f6-08540b1b4f2a fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:43:29.482685+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=2bbbe644-69f9-4b1e-99b5-a958f93d2cff fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:52:59.000000+00:00 app[api]: Build started by user alainelomapro@gmail.com
2020-12-12T17:53:23.443186+00:00 app[api]: Deploy e0ced2ae by user alainelomapro@gmail.com
2020-12-12T17:53:23.443186+00:00 app[api]: Release v5 created by user alainelomapro@gmail.com
2020-12-12T17:53:24.737970+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T17:53:27.791777+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T17:53:29.695868+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T17:53:29.731259+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T17:53:29.734243+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T17:53:31.000000+00:00 app[api]: Build succeeded
2020-12-12T17:53:32.484091+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T17:53:33.913367+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T17:53:33.947223+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T17:53:53.313902+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=8bd3736f-b293-4f8d-ad8f-9b4c245effc0 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:53:55.920783+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=48002cd3-fbe9-4353-8a6e-ce5260962392 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:54:04.443857+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index" host=intothedetails.herokuapp.com request_id=e6c56ece-baad-4d37-a468-7709fcc2dfc5 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:54:06.268870+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=aa3cd9bc-90bc-44c5-9bae-8b77c5e940a6 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:54:11.361192+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=3d98f3ce-c996-48e6-87a8-e25f7735d02f fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T17:54:12.739761+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=9a115339-67ce-4449-9d48-ae3fac0ae165 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T18:09:29.000000+00:00 app[api]: Build started by user alainelomapro@gmail.com
2020-12-12T18:09:57.634847+00:00 app[api]: Deploy 2b6ce08f by user alainelomapro@gmail.com
2020-12-12T18:09:57.634847+00:00 app[api]: Release v6 created by user alainelomapro@gmail.com
2020-12-12T18:09:58.749906+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T18:10:03.285472+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T18:10:05.000000+00:00 app[api]: Build succeeded
2020-12-12T18:10:06.060271+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T18:10:06.116409+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T18:10:06.120611+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T18:10:09.832708+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T18:10:12.348256+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T18:10:12.397746+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T18:14:58.113716+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=733c54ab-5cdb-4109-81df-129d31a34e26 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T18:15:00.078873+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=0c61b666-430c-4361-928e-6e0b1a2d9382 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T18:23:17.255686+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=31c1b954-df99-4181-8881-5296db924a82 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T18:23:19.030246+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=cec8bf1f-5254-4589-b99d-f8f6857d52f6 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T18:29:54.968505+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=f51ae23a-b5af-4c8b-96e6-c5ad1a6eac18 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T18:29:56.845057+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=bdd145cb-211e-450b-99df-4a51241016ce fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T18:32:23.154430+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T18:32:26.002504+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T18:32:27.890403+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T18:32:27.925750+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T18:32:27.929229+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T18:32:30.890019+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T18:32:32.713562+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T18:32:32.747388+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T18:37:16.718521+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=27a2efc0-9062-4d53-9c6c-cb370d343112 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=http
2020-12-12T18:37:18.878133+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=a3d3bb9e-cba7-4525-8372-96e85b41e746 fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=http
2020-12-12T18:37:39.866820+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=3423baa5-5884-4354-b3d2-57eff39dd9be fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T18:37:41.220783+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=c8c30f5f-4aa5-4052-a318-237a4eda092a fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T19:02:00.314095+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T19:02:03.327441+00:00 heroku[web.1]: Starting process with command `: gunicorn app:tuto`
2020-12-12T19:02:05.068649+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T19:02:05.111975+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T19:03:49.000000+00:00 app[api]: Build started by user alainelomapro@gmail.com
2020-12-12T19:04:13.564584+00:00 app[api]: Deploy 076a103f by user alainelomapro@gmail.com
2020-12-12T19:04:13.564584+00:00 app[api]: Release v7 created by user alainelomapro@gmail.com
2020-12-12T19:04:14.901646+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-12T19:04:19.851140+00:00 heroku[web.1]: Starting process with command `: gunicorn -b :26494 app:tuto`
2020-12-12T19:04:21.000000+00:00 app[api]: Build succeeded
2020-12-12T19:04:22.295995+00:00 heroku[web.1]: Process exited with status 0
2020-12-12T19:04:22.333013+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-12T19:04:33.076019+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intothedetails.herokuapp.com request_id=82238418-b900-433a-9aed-44f472a97cdc fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https
2020-12-12T19:04:37.476471+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intothedetails.herokuapp.com request_id=51d7b972-f737-4098-b292-210ebd1311cf fwd="105.178.116.156" dyno= connect= service= status=503 bytes= protocol=https

它在我输入“heroku logs --tail”后出现

我在某处看到我应该使用以下命令编辑 procfile:-b:$PORT

web : gunicorn -b :$PORT app:tuto

但后来我什至不知道我需要返回 go 多远才能将它放在我的文件中。 我应该再次“git init”吗? 我迷路了,累了,越来越生气,哈哈

我的 python 代码:


from flask import Flask, render_template, request
import nltk
from nltk.tokenize import sent_tokenize
from nltk.tokenize import word_tokenize
import re
from collections import *

app = Flask(__name__)

@app.route('/')
def index():
    return render_template('test.html')

@app.route('/', methods=['POST'])
def getvalue():
    letexte = request.form['letexte']
    user_input = request.form['user_input']
    user_title = request.form['user_title']
    input_two = request.form['input_two']
    
    lowercase_words = letexte.lower()
    
    tokenized = word_tokenize(lowercase_words)
    words = len(lowercase_words.split(' '))
    sentences = sent_tokenize(letexte)
    no_sent = len(sentences)
    
    def count_unique_words(text_string):
        word_list = re.split('; |, |\*|\n |\s', text_string)
        return list(dict.fromkeys(word_list))
    uniq_words = len(count_unique_words(letexte))
    
    nouns = []
    list_most_occur = []
    for w in tokenized:
        if len(w) > 2 and w[0]:
            nouns.append(w)
    
    counter_variables = Counter(nouns)
    most_occur = counter_variables.most_common(10)
    
    for mo in most_occur:
        list_most_occur.append(mo)
        
    input_count = tokenized.count(user_input)
    
    lesphrases = [ t for t in letexte.split('. ') or letexte.split('? ') or letexte.split('! ') if input_two in t]
    
    return render_template('return.html',ut=user_title, ltxt=letexte, w=words, uw=uniq_words, s=no_sent, lmo=list_most_occur,ui=user_input, ic=input_count, it=input_two, lp=lesphrases)
    

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

我的 html 表格


<form name="passdata" action="." method="POST" target="_blank">
                    <label for="subject">Subject Text</label>
                    <textarea id="subject" name="letexte" placeholder="" style="height:160px"></textarea>

                    <label for="fname">word 1</label>
                    <input type="text" id="fname" name="user_input" placeholder="how many times it appeard?">

                    <label for="fname">word 2</label>
                    <input type="text" id="fname" name="input_two" placeholder="sentences with the word">
                
                    <label for="lname">title</label>
                    <input type="text" id="lname" name="user_title" placeholder="">
                    </select>
                
                    <input type="submit" value="Submit">
                </form>

看起来应用程序正在构建到容器中没有问题,但在启动时崩溃了。 我不确定为什么在尝试获取您的家 url '/' 时它会崩溃。

关于图标问题,以下代码可帮助 flask 找到 static 资产,并可能有助于应用程序启动。

from flask import send_from_directory,


@app.route('/')
def index():
    return render_template('test.html')


@app.route('/return', methods=['POST'])
def getvalue():
    letexte = request.form['letexte']
    user_input = request.form['user_input']
    user_title = request.form['user_title']
    input_two = request.form['input_two']
    
    lowercase_words = letexte.lower()
    
    tokenized = word_tokenize(lowercase_words)
    words = len(lowercase_words.split(' '))
    sentences = sent_tokenize(letexte)
    no_sent = len(sentences)
    
    def count_unique_words(text_string):
        word_list = re.split('; |, |\*|\n |\s', text_string)
        return list(dict.fromkeys(word_list))
    uniq_words = len(count_unique_words(letexte))
    
    nouns = []
    list_most_occur = []
    for w in tokenized:
        if len(w) > 2 and w[0]:
            nouns.append(w)
    
    counter_variables = Counter(nouns)
    most_occur = counter_variables.most_common(10)
    
    for mo in most_occur:
        list_most_occur.append(mo)
        
    input_count = tokenized.count(user_input)
    
    lesphrases = [ t for t in letexte.split('. ') or letexte.split('? ') or letexte.split('! ') if input_two in t]
    
    return render_template('return.html',ut=user_title, ltxt=letexte, w=words, uw=uniq_words, s=no_sent, lmo=list_most_occur,ui=user_input, ic=input_count, it=input_two, lp=lesphrases)


@app.route('/favicon.ico')
def favicon():
    return send_from_directory(os.path.join(app.root_path, 'static'), 
        'favicon.ico', mimetype='image/vnd.microsoft.icon')

我遇到了这样的问题,要解决它,我必须确保 requirements.txt 文件中我需要的所有包都已成功安装,尤其是 dnspython

暂无
暂无

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

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