我不知道为什么这会给出错误,但是一切看起来都很完美我已经尝试了很多次但是这不起作用我甚至经历了stackoverflow的答案没有任何帮助。我有另一个应用程序,它与这个相同的procfile和端口工作正常但是这给出了一个错误。
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
app.py
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)
Procfile
web: python app.py runserver 0.0.0.0:5000
答案 0 :(得分:1)
我刚刚更改了托管应用程序并在heroku上创建了一个新的应用程序并且它有效。错误将是其中使用的构建包。
答案 1 :(得分:0)
我的回答与上述相同。我将所有文件复制并粘贴到新文件夹中,然后重新初始化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