簡體   English   中英

heroku 中的錯誤 No web processes running python web app

[英]error in heroku No web processes running python web app

我不知道為什么這會出現錯誤但一切看起來都很完美我已經嘗試了很多次但這不起作用我什至通過 stackoverflow 回答沒有任何幫助錯誤。

heroku 日志看起來像這樣

2018-04-09T08:05:54.000000+00:00 app[api]: Build started by user vipulrao355@gmail.com
2018-04-09T08:06:32.244340+00:00 app[api]: Deploy cdc01e38 by user vipulrao355@gmail.com
2018-04-09T08:06:32.244340+00:00 app[api]: Release v31 created by user vipulrao355@gmail.com
2018-04-09T08:05:54.000000+00:00 app[api]: Build succeeded
2018-04-09T08:09:55.988992+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=infinite-ridge-58576.herokuapp.com request_id=ca935db6-12ed-4332-ad05-4d7957bebece fwd="106.51.27.121" dyno= connect= service= status=503 bytes= protocol=https
2018-04-09T08:09:56.406479+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=infinite-ridge-58576.herokuapp.com request_id=65072529-5e63-4ac1-aa72-990359025bd2 fwd="106.51.27.121" dyno= connect= service= status=503 bytes= protocol=https

應用程序

import os
import csv
import pandas as pd
from flask import Flask, render_template, request, send_file
import clearbit
import json
clearbit.key = 'yourkey'
app = Flask(__name__)

APP__ROOT = os.path.dirname(os.path.abspath(__file__))


@app.route("/")
def index():
    return render_template("upload.html")

@app.route("/return-file/")
def return_file():

    return send_file('new.csv', as_attachment=True)

@app.route("/upload", methods=['POST'])
def upload():
    target = os.path.join(APP__ROOT)
    print(target)

    if not os.path.isdir(target):
        os.mkdir(target)

    for file in request.files.getlist("file"):
        filename = file.filename
        print(filename)
        destination = "/".join([target, filename])
        print(destination)
        file.save(destination)
        new_path = os.path.abspath(filename)
        print(new_path)
    df = pd.read_csv(new_path, sep=',', encoding="ISO-8859-1")
    saved_column = df['Company'].dropna()
    i = 0
    res = []
    for data in saved_column:
        n = saved_column.get(i)
        ns = len(n.split())
        if ns > 4:
            n = 'never get a website'
        else:
            print("a")
        i = i + 1
        print(n)
        data = clearbit.NameToDomain.find(name=n)
        print("\n")
        print(data)
        if data != None:
            res.append(data['domain'])
        else:
            res.append('none.com')
    print(res)
    df['Domain'] = res
    print(df['Domain'])
    df.to_csv("new.csv", index=False)
    downloadpath = "new.csv"
    os.remove(os.path.abspath(new_path) )

    return render_template("complete.html", name=downloadpath)

if __name__ == "__main__":
    port = int(os.environ.get("PORT", 5000))
    app.run(host='0.0.0.0', port=port, debug=True)

配置文件

web: python app.py runserver 0.0.0.0:5000

我和上面的回答一樣。 我將所有文件復制並粘貼到一個新文件夾中,然后重新初始化了 git repo。 然后 git add 並提交。 然后繼續使用 heroku 命令。

當未定義 Procfile 時也會發生這種情況。 或者 Procfile 已定義,但拼寫錯誤,如 procfile 而不是 Procfile。 或 Procfile 中有錯誤代碼。

我以這種方式添加了我的 procfile,而不是手動創建它。: echo "web: python app:app" > Procfile

當您嘗試部署時,您將看到以下錯誤消息:

remote: -----> Discovering process types
remote: 
`Mis-cased procfile detected; ignoring.
remote:  ~     Rename it to Procfile to have it honored.
remote: 
remote:        Procfile declares types -> (none)`

如果部署時一切順利,那么它應該如下所示:

remote: 
remote: -----> Discovering process types
remote:        Procfile declares types -> web

我剛剛更改了托管應用程序並在 heroku 上創建了一個新應用程序並且它起作用了。 錯誤將是其中使用的構建包。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM