Python H14 heroku中的错误-“;没有正在运行的web进程”;

Python H14 heroku中的错误-“;没有正在运行的web进程”;,python,html,django,heroku,web-deployment,Python,Html,Django,Heroku,Web Deployment,部署到heroku时发生错误H14 这是我的文件: web: gunicorn -w 4 -b 0.0.0.0:$PORT -k gevent main:app 登录heroku: 2017-01-23T10:42:58.904480+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=meetcapstone.herokuapp.com request

部署到heroku时发生错误H14 这是我的文件:

web: gunicorn -w 4 -b 0.0.0.0:$PORT -k gevent main:app
登录heroku:

2017-01-23T10:42:58.904480+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=meetcapstone.herokuapp.com request_id=df88efb5-a81a-4ac0-86dc-4e03d71266bb fwd="81.218.117.137" dyno= connect= service= status=503 bytes=
2017-01-23T10:42:59.009135+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=meetcapstone.herokuapp.com request_id=21cea981-36b0-4410-891f-548bbc29f0ee fwd="81.218.117.137" dyno= connect= service= status=503 bytes=
要求:

Flask==0.11.1
passlib==1.7.0
SQLAlchemy==1.1.5
Werkzeug==0.11.15
gunicorn==19.0.0
gevent==1.2.1

这里的问题是,你没有运行任何网络动态。您可以通过以下方式告诉Heroku执行此操作:

$ heroku ps:scale web=1
这将迫使Heroku启动web dyno,从而执行gunicorn命令。

在此命令之前:

heroku ps:scale web=1
我不得不再次删除和添加构建包,清空并提交它,然后重新部署到heroku

heroku buildpacks:clear
heroku buildpacks:add --index heroku/python

经过3个小时的调试,我已经找到了我的应用程序导致此错误的原因:

  • 我的
    Procfile
    的大小写不正确
  • my
    venv中未安装gunicorn
  • 依我看,这个错误应该在Heroku那边提出。作为初学者,这种错误很难追踪

    更多信息–更多关于初始化您的应用程序的信息


    我在这里也遇到了问题。我的问题是我的Procfile是“Procfile.txt”。 解决我的问题的方法是从Procfile中删除文件扩展名,然后重新提交 把东西推给heroku

    • 登录Heroku仪表板并打开项目
    • 转到“设置”
    • 从构建包列表中删除heroku/python
    • 然后单击添加构建包→ 选择“Python”→ 保存更改
    • 在代码中激活环境
    • 运行heroku ps:scale web=1

    你完了

    我没有声誉来回复正确的评论,但对我来说,问题是我的根目录中没有run.gunicorn.sh文件,这导致了相同的“无web进程运行”错误

    如果没有此文件,请使用以下内容创建它:

    gunicorn -b :5000 --access-logfile - --error-logfile - build:app
    
    其中,“build”是python文件的名称(本例中为build.py),app是代码中应用的名称


    还应确保requirements.txt中包含gunicorn,就像其他人已经指出的那样。


    web:gunicorn到web gunicorn(删除“:”)

    我通过配置Dynos并手动启用唯一的dyno解决了这个问题。

    我在web gui上缺少Dynos。用于缩放的cli命令不起作用。我也可能有一个错误的运行:web声明缺少$PORT。要修复:

    heroku.yml必须具有使用$PORT变量的web声明:

    build:
      docker:
        web: Dockerfile
    run:
      web: uvicorn main:app --reload --host 0.0.0.0 --port $PORT
    
    然后我推到了赫罗库

    heroku buildpacks:clear
    heroku buildpacks:add --index heroku/python
    
    之后,它一定添加了web dyno,然后我可以运行:

    heroku ps:scale web=1
    

    现在fastapi uvicorn运行了。

    这不是您的代码的问题,但是我已经收到过几次这个错误消息,我犯的错误导致它一直在编写

    web:gunicorn
    
    而不是

    web: gunicorn
    

    这个空间确实会引起很多问题。

    请注意Procfile的命名和位置()Procfile始终是一个名为Procfile的“简单文本文件”,没有文件扩展名。(Procfile.txt不可接受!)Procfile必须位于应用程序的根目录中。如果放置在其他任何位置,它将不起作用。

    请显示部署时的整个日志。启动gunicorn时有错误吗?我应该把它写在procfile中吗?太棒了!我在输入了一个格式不正确的procfile并纠正它之后触发了这个问题。奇怪的是,Heroku仪表板中的dyno必须先被禁用。谢谢缩放动态!▸ 找不到该进程类型(web)。(啊,好吧,缺少一个Procfile——非常混乱,除非您使用他们的示例代码)在代码中激活您的环境是什么意思?