如何在heroku中的rails应用程序中运行python脚本?

时间:2022-06-08 22:09:53

I have a rails application hosted in heroku. I also wrote a web scrapper using scrapy in python.I need to run the python script from the rails application in heroku,I will explain with an example.

我有一个托管在heroku的rails应用程序。我还用python编写了一个用剪贴画的web scrapper。我需要从heroku中的rails应用程序运行python脚本,我将用一个示例进行解释。

Eg:The user will input the url to scrap in my rails app.Then the rails app give control to python script to scrap data which sends response as json object.Then we have to render the json result in the web app.I have to host this application in heroku.

用户将在我的rails应用中输入要销毁的url,然后rails应用将控制权交给python脚本以销毁以json对象发送响应的数据。然后,我们必须在web应用程序中呈现json结果,我必须在heroku中托管这个应用程序。

1 个解决方案

#1


3  

There is a great gem called rubypython. It embeds a running Python interpreter in the Ruby application.

有一颗叫做rubypython的宝石。它在Ruby应用程序中嵌入一个正在运行的Python解释器。

FYI their homepage

通知你他们的主页

#1


3  

There is a great gem called rubypython. It embeds a running Python interpreter in the Ruby application.

有一颗叫做rubypython的宝石。它在Ruby应用程序中嵌入一个正在运行的Python解释器。

FYI their homepage

通知你他们的主页