Python Twitter Bot w / Heroku错误:R10启动超时 [英] Python Twitter Bot w/ Heroku Error: R10 Boot Timeout

查看:128
本文介绍了Python Twitter Bot w / Heroku错误:R10启动超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个简单的python twitter bot,它使用以下库定期执行各种函数:

  TwitterFollowBot == 2.0。 2 
schedule == 0.3.2

当我在我的电脑,我想将它迁移到Heroku,以便它可以独立运行。在Heroku上执行它时,它应该在超时前运行60秒:

错误R10(引导超时) - > Web进程无法在启动后的60秒内绑定到$ PORT



经过研究,我发现Heroku动态切换端口和我的应用程序必须连续指定它应该运行的端口。从另一个线程我读到,一个可能的解决方案需要我改变我的Procfile,所以我将PORT变量添加到最后:

Procfile web:python app.py $ PORT



这没有效果,所以我再次用 $ {PORT}

我也试着用 bot切换 web: (它阻止了我的应用程序正常执行)



我找到了解决此问题的其他解决方案,它适用于使用Django的节点或Python应用程序,Flask等等...但是,我无法找到一个简单的.py应用程序的解决方案。这甚至有可能吗?或者我应该使用Flask创建我的应用程序并尝试其他修复程序? 解决方案

如果它不提供任何Web内容那么你不需要运行 web 进程 - 把它称为别的东西像 bot ,然后执行:




  • heroku ps:scale web = 0

  • heroku ps:scale bot = 1



,你不会再有R10了。


I have developed a simple python twitter bot which periodically executes various functions using the following libraries:

TwitterFollowBot==2.0.2
schedule==0.3.2

The application works fine when I execute it on my computer, and I wanted to migrate it to Heroku so it could run independently. Upon executing it on Heroku it works as it should for 60 seconds before timing out:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

After researching this, I found out that Heroku dynamically switches ports and my application must continuously specify which port it should run on. From another thread I read that a possible solution required me to alter my Procfile, so I appended the PORT variable to the end:

Procfile: web: python app.py $PORT

This had no effect so I tried it again with ${PORT},
And I also tried switching web: with bot: (which stopped my application from executing properly)

I found other solutions to this issue which worked for node, or python applications using Django, Flask, etc... However, I was unable to find a solution for just a simple .py application. Is this even possible? Or should I create my app with Flask and attempt one of the other fixes?

解决方案

If it doesn't provide any web content then you don't need to run a web process - call it something else like bot and then do:

  • heroku ps:scale web=0
  • heroku ps:scale bot=1

and you won't get any more R10s.

这篇关于Python Twitter Bot w / Heroku错误:R10启动超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆