如何在Heroku中运行命令行python工具 [英] How to run command line python tool in Heroku

查看:159
本文介绍了如何在Heroku中运行命令行python工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Heroku平台的新手。我的要求是从Heroku运行python命令行工具。我不确定这是否可以直接完成,因为那里的Web应用程序带有其他必需文件,例如procfile等。我想采取的方法是创建一个可以调用python脚本的Web应用程序。但是接下来的问题是如何调用python脚本,该脚本也允许向其传递参数。我需要分别部署python工具和网络应用程序吗?

解决方案

如果希望自动执行python脚本,请使用



具体取决于任务的持续时间和复杂程度是/将在将来,您将需要一个自定义的时钟过程,这不是免费的。



如果您想自己执行脚本,则将CD插入项目,使用heroku登录并使用 heroku运行python


I am new to Heroku platform. My requirement is to run a python command line tool from Heroku. I am not sure if this can be done directly as applications over there are the web applications with other mandatory files such as procfile etc. The approach I am thinking to take is to create a web app that could call the python script. But next question comes up is how to call python script which allows passing arguments to it too. And do I need to deploy the python tool and web app separately? Please guide me with the approach.

解决方案

If you want that python scripts are executed automatically, use Heroku Sheduler. It will count towards your dyno usage and is free.

Depending on how long and complex your tasks are/will be in the future, you will need a custom clock process, which is not free.

If you want to execute a script yourself, then cd into your project, login with heroku and use heroku run python.

这篇关于如何在Heroku中运行命令行python工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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