简体   繁体   English

Heroku 成功部署,但我仍然没有运行任何 web 进程

[英]Heroku successfully deployed but I still keep getting no web process running

I'm trying to push a telegram bot into Heroku.我正在尝试将电报机器人推送到 Heroku。 These are files within my folder.这些是我文件夹中的文件。

/new_bot
---/requirements.txt
---/Procfile   #worker: python new_bot.py 
---/init.py    #empty
---/new_bot.py
---/.env

My procfile does NOT have any .txt extension.我的 procfile 没有任何 .txt 扩展名。 Inside the procfile is worker: python new_bot.py I am using atom text editor. procfile 里面是worker: python new_bot.py我正在使用 atom 文本编辑器。

In my requirements .txt folder, these are the following requirements在我的需求 .txt 文件夹中,这些是以下需求

requests
telegram
tornado>=5.1

The new_bot.py script is here new_bot.py 脚本在这里

from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackQueryHandler, CallbackContext
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
import requests

PORT = int(os.environ.get('PORT', 443))

TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")

def hello(update, context):
    update.message.reply_text('Hello! \U0001F600')

def main():  
    updater = Updater(TOKEN, use_context=True)
    dp = updater.dispatcher
    dp.add_handler(CommandHandler("hello", hello))
    updater.start_webhook(listen="0.0.0.0",
                          port=int(PORT),
                          url_path=TOKEN,
                          webhook_url='https://abc.herokuapp.com/' + TOKEN)

    updater.start_polling()

    updater.idle()
if __name__ == '__main__':
    main()

So it managed to build successfully, and I ran and did heroku ps:scale worker=1 in my heroku CLI, managed to deploy it successfully which showed this:所以它成功构建,我在我的 heroku CLI 中运行并执行heroku ps:scale worker=1 ,成功部署它,显示了这一点:

2021-07-15T11:56:11.022397+00:00 heroku[worker.1]: State changed from crashed to starting
2021-07-15T11:56:15.944190+00:00 heroku[worker.1]: Starting process with command `python new_bot.py`
2021-07-15T11:56:17.093075+00:00 heroku[worker.1]: State changed from starting to up
2021-07-15T11:56:21.000000+00:00 app[api]: Build succeeded
2021-07-15T11:56:22.155897+00:00 app[worker.1]: 2.26.0

On my Heroku UI, I am seeing this在我的 Heroku UI 上,我看到了这个

worker
python new_bot.py
ON

However, I still keep getting this error at=error code=H14 desc="No web processes running" method=GET .但是,我仍然不断收到此错误at=error code=H14 desc="No web processes running" method=GET I have seen many places in Stackoverflow that I have to use heroku ps:scale web=1 , which is different from the command I used earlier which was heroku ps:scale worker=1 .我在 Stackoverflow 中看到很多地方必须使用heroku ps:scale web=1 ,这与我之前使用的命令heroku ps:scale worker=1 Can I just check what am I doing wrong here and how do I remedy it?我可以检查一下我在这里做错了什么以及如何补救吗? Any help will be appreciated.任何帮助将不胜感激。

Edit: Hi guys I've actually found the problem already.编辑:嗨,伙计们,我实际上已经发现了问题。 It has to do with它与

updater.start_webhook(listen="0.0.0.0",
                          port=int(PORT),
                          url_path=TOKEN,
                          webhook_url='https://abc.herokuapp.com/' + TOKEN)

Thanks for helping anyway!无论如何感谢您的帮助!

For a web process in heroku you need to add something like this to your Proc file:对于 heroku 中的 Web 进程,您需要在 Proc 文件中添加如下内容:

Below is a rails equivalent, you need specific to your app.下面是一个 rails 等效项,您需要特定于您的应用程序。

web: bundle exec rails server -p $PORT

And then run:然后运行:

heroku ps:scale web=1

暂无
暂无

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

相关问题 我在 Heroku 上成功部署了我的 Web 应用程序,但显示应用程序错误 - I successfully deployed my web app on Heroku but shows Application Error Heroku - 没有正在运行的Web进程 - Heroku - No web process running 应用程序(Python Django,PostgreSql)已成功部署在Heroku上,但是尝试打开时出现错误 - App (Python Django, PostgreSql) is deployed successfully on Heroku, but I'm getting error when trying to open 我通过 Heroku 部署了我的 Django 服务器,构建成功,但在部署的 URL 上不断收到“应用程序错误” - I deployed my Django server via Heroku, the build was successful, but keep getting 'Application Error' on the deployed URL Streamlit Python 应用程序已成功部署到 Heroku,但出现应用程序错误 - Streamlit Python app deployed successfully to Heroku, but I get an application error Heroku Procfile 正常并且 dynos 已正确缩放,但我仍然收到错误消息“没有 Web 进程正在运行” - Heroku Procfile is OK and dynos are correctly scaled but I still get the error message “No web processes running” Heroku上的Django应用程序,已成功部署但无法提供服务 - Django app on Heroku, deployed successfully but could not be served Heroku 上的 OpenCV 错误,但模型成功部署 - OpenCV error on Heroku but model successfully deployed 成功部署 Django 到 Heroku 但收到应用程序错误 - Successfully deployed Django to Heroku but received application error Heroku 应用部署成功但应用报错 - Heroku app deployed successfully but Application Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM