简体   繁体   English

如何在 Heroku 上运行两个脚本?

[英]How can I run two scripts on Heroku?

I'm building a Dash Webapp, I have two Python scripts: one is the main Dash app and the other script is supposed to retrieve data.我正在构建一个 Dash Webapp,我有两个 Python 脚本:一个是主 Dash 应用程序,另一个脚本应该用于检索数据。

Since I can't "merge" my two scripts on one, I decided to have the second script send my data to a Database while the Dash script receives this data with a DB query.由于我无法在一个脚本上“合并”我的两个脚本,我决定让第二个脚本将我的数据发送到数据库,而 Dash 脚本通过数据库查询接收此数据。

Now I need to deploy it online and have both the scripts running in parallel, since one will feed data to the DB and the other one will fetch this data and chart it on a webpage, but is it possible to run at once two Python files in parallel?现在我需要在线部署它并使两个脚本并行运行,因为一个将数据提供给数据库,另一个将获取此数据并将其绘制在网页上,但是否可以同时运行两个 Python 文件在平行下? Can I do it on a single dyno or should I use two different apps (one for the webapp and another one for the data)?我可以在单个 dyno 上完成,还是应该使用两个不同的应用程序(一个用于 webapp,另一个用于数据)?

Check this .检查这个 It says:它说:

The quickest way maybe to list the commands to run, each followed by an & , with a wait -n in the end, in the Procfile , eg:最快的方法可能是在Procfile列出要运行的命令,每个命令后跟一个& ,最后一个wait -n ,例如:

web: puma -C config/puma.rb & sidekiq & wait -n

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

相关问题 如何一次运行两个 Python 脚本? - How can I run two Python scripts at once? (多线程-Python)如何创建一个运行两个脚本的脚本,我通常从两个不同的终端运行这些脚本? - (Multithreading-Python) How I can create a script that run two scripts which I usually run from two different terminals? 我可以在 pm2 服务上运行两个不同的脚本吗? - Can I run two different scripts on a pm2 service? 意外安装了Python 3.4.1的两个版本…无法运行任何脚本,无法导入任何模块,如何解决此问题? - Accidentally installed two versions of Python 3.4.1… Can't run any scripts, no modules can import, how can I fix this? 如何在VCSA上基于vSphere警报运行Pyvmomi脚本 - How can I run Pyvmomi scripts based on vSphere alarms on the VCSA 如何在安装Canopy的终端中运行Python脚本? - How can I run Python scripts in terminal with Canopy installation? 如何一次运行多个 python 脚本? - How can I run many python scripts at once? 如何更好地使用两个脚本导入python模块? - How can I better import python modules with two scripts? 我怎样才能让这两个脚本一起工作? - How can I make this two scripts work together? 如何在两个 python 脚本之间进行通信? - How can I communicate between two python scripts?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM